stretch – matoken's blog https://matoken.org/blog Is there no plan B? Wed, 29 Mar 2017 09:08:17 +0000 ja hourly 1 https://wordpress.org/?v=6.8.3 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg stretch – matoken's blog https://matoken.org/blog 32 32 DebianのisoイメージをUSBメモリに書き込み https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/ https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/#respond Wed, 29 Mar 2017 09:08:17 +0000 http://matoken.org/blog/?p=1576 gistに貼ってたものだけどせっかくなのでこちらにも.

ファイルダウンロード

今回はDebian stretch Debian Installer rc2のi386版のnetinst.

  • debian-stretch-DI-rc2-i386-netinst.iso : イメージ本体
  • SHA512SUMS : isoファイルのチェックサムファイル
  • SHA512SUMS.sign : SHA512SUMSの署名ファイル
$ wget http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/debian-stretch-DI-rc2-i386-netinst.iso http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/SHA512SUMS.sign http://cdimage.debian.org/cdimage/stretch_di_rc2/i386/iso-cd/SHA512SUMS

※i386/amd64をよく使う場合はmulti-archを使うと1つのUSBメモリでi386/amd64が利用できて便利

チェックサムファイルの署名確認

チェックサムファイルのSHA512SUMSが正常なものか確認

$ gpg --verify SHA512SUMS.sign
gpg: 署名されたデータが'SHA512SUMS'にあると想定します
gpg: 2017年02月02日 07時45分30秒 JSTに施された署名
gpg:                RSA鍵DA87E80D6294BE9Bを使用
gpg: "Debian CD signing key <debian-cd@lists.debian.org>"からの正しい署名 [不明の]
gpg: *警告*: この鍵は信用できる署名で証明されていません!
gpg:       この署名が所有者のものかどうかの検証手段がありません。
 主鍵フィンガープリント: DF9B 9C49 EAA9 2984 3258  9D76 DA87 E80D 6294 BE9B

公開鍵が見つかりません(public key not found)というエラーの場合はgpg --keyserver keyring.debian.org --recv-keys DA87E80D6294BE9Bで鍵をインポートして再度確認.鍵のIDやフィンガープリントは以下のページでも確認できる

ハッシュ確認

isoファイルが正しくダウンロードされているか確認
以下の例はdebian-stretch-DI-rc2-i386-netinst.isoしかダウンロードしていないのでそれ以外のエラーや警告は無視する

$ sha512sum -c SHA512SUMS
sha512sum: debian-mac-stretch-DI-rc2-i386-netinst.iso: そのようなファイルやディレクトリはありません
debian-mac-stretch-DI-rc2-i386-netinst.iso: FAILED open or read
debian-stretch-DI-rc2-i386-netinst.iso: 完了
sha512sum: debian-stretch-DI-rc2-i386-xfce-CD-1.iso: そのようなファイルやディレクトリはありません
debian-stretch-DI-rc2-i386-xfce-CD-1.iso: FAILED open or read
sha512sum: 警告: 一覧にある 2 個のファイルが読み込めませんでした

usbメモリへの書き込み

USBメモリの確認

書き込み先のデバイスが正しいか確認する
USBメモリ接続直後にdmesgを確認したりfdiskコマンドやマウントして中を確認したり……

$ dmesg
  :
[414356.444121] usb 1-1.2: New USB device found, idVendor=13fe, idProduct=1a00
[414356.444128] usb 1-1.2: New USB device strings: Mfr=0, Product=11, SerialNumber=0
[414356.444131] usb 1-1.2: Product: USB 2.0 HUB
[414362.925178] usb-storage 1-1.2.1:1.0: USB Mass Storage device detected
[414362.925967] scsi host6: usb-storage 1-1.2.1:1.0
[414364.184209] sd 6:0:0:1: [sdb] 980480 512-byte logical blocks: (502 MB/479 MiB)
[414364.187102] sd 6:0:0:1: [sdb] Write Protect is off
[414364.187106] sd 6:0:0:1: [sdb] Mode Sense: 23 00 00 00
[414364.190339] sd 6:0:0:1: [sdb] No Caching mode page found
[414364.190345] sd 6:0:0:1: [sdb] Assuming drive cache: write through
[414364.201730]  sdb: sdb1
[414364.201734] sdb: p1 size 982496 extends beyond EOD, enabling native capacity
[414364.214471]  sdb: sdb1
[414364.214475] sdb: p1 size 982496 extends beyond EOD, truncated
[414364.228961] sd 6:0:0:1: [sdb] Attached SCSI removable disk
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 478.8 MiB, 502005760 bytes, 980480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start    End Sectors   Size Id Type
/dev/sdb1  *       32 982527  982496 479.8M  6 FAT16

USBメモリのアンマウント

USBメモリをマウントしている場合はアンマウントしておく

$ sudo umount /dev/sdb1
$ mount | grep /dev/sdb

パーテイション情報の削除

念の為パーテイション情報を削除しておく

$ sudo wipefs /dev/sdb
offset               type
----------------------------------------------------------------
0x1fe                dos   [partition table]

$ sudo wipefs -a /dev/sdb ; sync
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioctl to re-read partition table: 成功です

書き込み

進捗状態を確認したい場合はpvコマンドを間に挟んだり,ddrescue / ddrescueなどが利用できる

$ sudo dd if=./debian-stretch-DI-rc2-i386-netinst.iso of=/dev/sdb bs=4M ; sync
95+1 レコード入力
95+1 レコード出力
401604608 bytes (402 MB, 383 MiB) copied, 176.874 s, 2.3 MB/s

書き込みが終わったらUSBメモリを取り外してターゲットマシンで利用する

VirtualBoxで起動確認(余録)

手軽に試せるマシンがなかったのでVirtualBoxからUSBメモリを起動して確認した

USBメモリのディスクイメージ作成

直にUSBメモリを指定できないのでUSBメモリへアクセスするためのvmdkイメージを作成

$ sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/sdb -filename sdb.vmdk 
RAW host disk access VMDK file sdb.vmdk created successfully.
$ sudo cat sdb.vmdk
# Disk DescriptorFile
version=1
CID=1722e641
parentCID=ffffffff
createType="fullDevice"

# Extent description
RW 980480 FLAT "/dev/sdb" 0

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="972"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="c2c9d560-049f-4c44-bf8a-0b85e820ba12"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

USBメモリにアクセス権のあるユーザでVirtualBoxを起動してUSBメモリのイメージを指定して起動

(ここいまいち……)

$ gksudo virtualbox

]]>
https://matoken.org/blog/2017/03/29/write-debian-iso-image-to-usb-memory/feed/ 0
Screenfetch的な情報表示コマンドのNeofetch https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/ https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/#respond Tue, 06 Dec 2016 21:27:09 +0000 http://matoken.org/blog/?p=1476 Screenfetch的な情報表示コマンドのNeofetch

よくデスクトップのキャプチャを取得するときに表示されているScreenfetchコマンドというものがあります.システムの情報とアスキーアートを素敵に表示してくれます. これににたものでNetfetchというものを見かけたので試してみました.こちらは画像も扱えるようです.

導入

以下のページに各種環境への導入方法が書かれています.

Debian sid/stretchにはパッケージがあるようなことが書かれていますが,

Neofetch is in Debian Unstable/Stretch's official repositories.

今はsidのみのようです.

ということでひとまずstretchではこんな感じで導入しました.

$ #-- /etc/apt/sources.list.d/neofetch を作る
$ sudo apt edit-sources neofetch
$ cat /etc/apt/sources.list.d/neofetch.list
deb http://dl.bintray.com/dawidd6/neofetch jessie main
$ #-- 鍵のインポート
$ wget "https://bintray.com/user/downloadSubjectPublicKey?username=bintray" -O Release-neofetch.key
$ gpg Release-neofetch.key
pub   rsa4096 2015-02-17 [SC]
      8756C4F765C9AC3CB6B85D62379CE192D401AB61
uid           Bintray (by JFrog) <bintray@bintray.com>
sub   rsa4096 2015-02-17 [E]
$ sudo apt-key add Release-neofetch.key
$ rm Release-neofetch.key
$ #-- pkg情報更新&pkg導入
$ sudo apt update
$ sudo apt install neofetch

早速実行

$ neofetch --help

    NEOFETCH

    USAGE: neofetch --option "value" --option "value"

    NOTE: There's also a config option for each flag below.

    Info:
    --disable infoname          Allows you to disable an info line from appearing
                                in the output.
                                NOTE: You can supply multiple args. eg.
                                'neofetch --disable cpu gpu disk shell'
                                NOTE: The arguments must all be lowercase.
    --os_arch on/off            Hide/Show OS architecture.
    --speed_type type           Change the type of cpu speed to display.
                                Possible values: current, min, max, bios,
                                scaling_current, scaling_min, scaling_max
                                NOTE: This only support Linux with cpufreq.
    --cpu_shorthand type        Shorten the output of CPU
                                Possible values: name, speed, tiny, on, off
    --cpu_cores type            Whether or not to display the number of CPU cores
                                Takes: logical, physical, off
                                NOTE: 'physical' doesn't work on BSD.
    --cpu_speed on/off          Hide/Show cpu speed.
    --cpu_temp on/off           Hide/Show cpu temperature.
                                NOTE: This only works on Linux and BSD.
                                NOTE: For FreeBSD-based systems, you need to enable coretemp
                                      kernel module.
    --distro_shorthand on/off   Shorten the output of distro (tiny, on, off)
                                NOTE: This option won't work in Windows (Cygwin)
    --kernel_shorthand on/off   Shorten the output of kernel
                                NOTE: This option won't work in BSDs (except PacBSD and PC-BSD)
    --uptime_shorthand on/off   Shorten the output of uptime (tiny, on, off)
    --refresh_rate on/off       Whether to display the refresh rate of each monitor
                                Unsupported on Windows
    --gpu_brand on/off          Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
    --gtk_shorthand on/off      Shorten output of gtk theme/icons
    --gtk2 on/off               Enable/Disable gtk2 theme/icons output
    --gtk3 on/off               Enable/Disable gtk3 theme/icons output
    --shell_path on/off         Enable/Disable showing $SHELL path
    --shell_version on/off      Enable/Disable showing $SHELL version
    --ip_host url               Url to query for public IP
    --song_shorthand on/off     Print the Artist/Title on seperate lines
    --birthday_shorthand on/off Shorten the output of birthday
    --birthday_time on/off      Enable/Disable showing the time in birthday output
    --birthday_format format    Format the birthday output. (Uses 'date' cmd format)

    Text Formatting:
    --colors x x x x x x        Changes the text colors in this order:
                                title, @, underline, subtitle, colon, info
    --underline on/off          Enable/Disable the underline.
    --underline_char char       Character to use when underlining title
    --bold on/off               Enable/Disable bold text

    Color Blocks:
    --color_blocks on/off       Enable/Disable the color blocks
    --block_width num           Width of color blocks in spaces
    --block_height num          Height of color blocks in lines
    --block_range start end     Range of colors to print as blocks

    Bars:
    --bar_char 'elapsed char' 'total char'
                                Characters to use when drawing bars.
    --bar_border on/off         Whether or not to surround the bar with '[]'
    --bar_length num            Length in spaces to make the bars.
    --bar_colors num num        Colors to make the bar.
                                Set in this order: elapsed, total
    --cpu_display mode          Bar mode.
                                Takes: bar, infobar, barinfo, off
    --memory_display mode       Bar mode.
                                Takes: bar, infobar, barinfo, off
    --battery_display mode      Bar mode.
                                Takes: bar, infobar, barinfo, off
    --disk_display mode         Bar mode.
                                Takes: bar, infobar, barinfo, off

    Image:
    --image type                Image source. Where and what image we display.
                                Possible values: wall, ascii,
                                /path/to/img, /path/to/dir/, off
    --size 00px | --size 00%    How to size the image.
                                Possible values: auto, 00px, 00%, none
    --crop_mode mode            Which crop mode to use
                                Takes the values: normal, fit, fill
    --crop_offset value         Change the crop offset for normal mode.
                                Possible values: northwest, north, northeast,
                                west, center, east, southwest, south, southeast

    --xoffset px                How close the image will be to the left edge of the
                                window. This only works with w3m.
    --yoffset px                How close the image will be to the top edge of the
                                window. This only works with w3m.
    --bg_color color            Background color to display behind transparent image.
                                This only works with w3m.
    --gap num                   Gap between image and text.
                                NOTE: --gap can take a negative value which will
                                move the text closer to the left side.
    --clean                     Delete cached files and thumbnails.

    Ascii:
    --ascii value               Where to get the ascii from, Possible values:
                                distro, /path/to/ascii
    --ascii_colors x x x x x x  Colors to print the ascii art
    --ascii_distro distro       Which Distro's ascii art to print
                                NOTE: Arch and Ubuntu have 'old' logo varients.
                                NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos.
                                NOTE: Ubuntu has flavor varients.
                                NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME'
                                or 'Ubuntu-Budgie' to use the flavors.
    --ascii_logo_size           Size of ascii logo.
                                Supported distros: Arch, Gentoo, Crux, OpenBSD.
    --ascii_bold on/off         Whether or not to bold the ascii logo.
    --logo | -L                 Hide the info text and only show the ascii logo.

    Screenshot:
    --scrot | -s /path/to/img   Take a screenshot, if path is left empty the screen-
                                shot function will use $scrot_dir and $scrot_name.
    --upload | -su /pth/t/img   Same as --scrot but uploads the scrot to a website.
    --image_host                Website to upload scrots to. Takes: imgur, teknik
    --scrot_cmd cmd             Screenshot program to launch

    Other:
    --config /path/to/config    Specify a path to a custom config file
    --config none               Launch the script without a config file
    --help                      Print this text and exit
    --version                   Show neofetch version
    -v                          Display error messages.
    -vv                         Display a verbose log for error reporting.

オプション結構多いです. とりあえず素で実行.

20161207_05:12:12-5188

情報もScreenfetchより増えています.

20161207_05:12:20-9093

次は画像を指定してみます.画像サイズが大きかったので25%に縮小もしています. 楽しい :)

20161207_05:12:35-3963

20161207_06:12:30-16979

画像の表示については環境によってうまく行く行かないがあるようです.うまく表示されない場合は以下のWikiを参照すると良さそうです.

]]>
https://matoken.org/blog/2016/12/07/screenfetch-like-information-display-command-neofetch/feed/ 0
Mumbleでリモート会議 https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/ https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/#respond Fri, 02 Dec 2016 16:53:14 +0000 http://matoken.org/blog/?p=1461

先週ですが,FSIJ 月例会に参加していました. といっても東京に出て行ったわけではなくネットワーク開催だったので家からの参加です.

ということでMumbleというソフトウェアで音声チャット + Etherpad(ウェブブラウザベース)でテキスト交換という環境でした. Mumbleを前もって試していればよかったのだけど直前に入れてなかなか参加できず途中からの参加になりましたorz~

MumbleはDebian stretch amd64環境ではパッケージが存在する( mumble )のでこれを導入するだけでした.マルチプラットホームで各種環境向けにも存在して,Androidなどでも利用できるようです. – Mumble, the open source VoIP solutionPlumble – Mumble VOIP (Free) – Google Play の Android アプリPlumble – Mumble VOIP – Google Play の Android アプリ

今回使用機器は以下のような感じ.でしたが,スピーカーは試行錯誤している時に繋いだもので後で試すと本体のスピーカーで大丈夫でした.

  • PC : Thinkpad X220(Debian stretch amd64)
  • マイク : 3.5mmジャックに直接挿せるもの(型番不明)
  • スピーカー : ELECOM LBT-SPTR01AV(Bluetooth)

このときMumble利用時に嵌ったところをメモしておきます. – ヘッドホンとマイクが1つの端子の端末でマイクを繋ぐとヘッドホンもそちらを向いてしまって音が出なかった – Bluetothヘッドセットを繋ぐとそちらから音が出るようになったがマイクがうまく働かない – PulseAudio Volume Control (pavucontrol)で見るとマイクがミュートになっていたので解除してMumbleに割り当て – 伝送方式を"push to talk"にしたがpushがわからなかった -> ショートカットで適当なキーに割り当て(Mumble非アクティブ時も有効)

  • その他
    • Awesome WM環境ではMumbleが最小化してしまうと窓を復帰させる方法が今のところわからない.タスクトレイのアイコンをクリックしても出てこない.(Xfce4はアイコンクリックで出てくるよう)
    • 一回設定できればフォーカスがなくてもショートカットが効いて話せるのでとりあえず使えるけどチャットと誰が話しているかのアイコンの確認(唇アイコンが赤くなる)が出来ない(オーバーレイの設定でどうにかなりそう?)
    • アイコンを右クリックしてそのまま離すと丁度終了になってしまう…….
    • Mumbleの音声品質は16kbps/40kbps/72kbpsから選択可能(規定値は40k)
    • push to talkを使うとその時しか音声が飛ばないので周りの環境に左右されにくくて良い(キー入力の音や環境音が入りにくい)

最近はUstream.tv/Youtube Liveなどの動画配信やBBB(BigBlueButton)などの動画を使ったオンライン会議システムなどで中継ということが多いですが,手弁当の勉強会なんかだと回線などの問題でうまく行かなかったりすることが多いですが割り切って音声のみの中継にしてしまうのもありだなと感じました.

最近リモート参加した勉強会

]]>
https://matoken.org/blog/2016/12/03/remote-conference-with-mumble/feed/ 0
Android端末をLinuxのタッチパッド替わりにしたい(Bluetooth利用のBlink) https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/ https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/#respond Fri, 17 Jun 2016 13:36:25 +0000 http://matoken.org/blog/?p=1394

最近またポインティングデバイスにApple Wireless Trackpadを利用するようになりましたが持ち運びには少し嵩張ります.マウスを持ち運ぶのもかさばります.
Ubuntu TouchでHDMI接続時にタッチデバイスになるというのを見てAndroid端末をタッチデバイスにすることが出来るのでは?それなら荷物増え無いしいいかもと思って少し調べてみました.

BlinkはBluetooth接続かつPC側でデーモンを動かす必要があります.
先ずBluetoothペアリングをしておき,PC側でデーモンを導入します.

  • 必要パッケージの導入

$ sudo apt install bluez python-bluez xdotoolsudo apt-get install bluez python-bluez xdotool
  • デーモンの導入

$ git clone https://github.com/drpain/blink-server.git ~/.blink

以下のようにしてデーモンを起動するのですが,この記事を書いている時点でのDebian stretch testing amd64では以下のようなエラーとなります.

$ sudo ~/.blink/bluetooth_server.py
Traceback (most recent call last):
  File "/home/mk/.blink/bluetooth_server.py", line 25, in <module>
    profiles         = [ SERIAL_PORT_PROFILE ]
  File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 176, in advertise_service
    raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

GuihubのHELPを参考に*/etc/bluetooth/main.conf*を以下のように修正します.

diff --git a/bluetooth/main.conf b/bluetooth/main.conf
index 372fd8c..2f7cc4a 100644
--- a/bluetooth/main.conf
+++ b/bluetooth/main.conf
@@ -64,6 +64,9 @@
 # 'false'.
 #FastConnectable = false

+# "drpain/blink-server: This is the server you would need to be able to run the Blink Android Application." https://github.com/drpain/blink-server
+DisablePlugins = pnat
+
 #[Policy]
 #
 # The ReconnectUUIDs defines the set of remote services that should try

設定を反映するためにbluetoothdを再起動してサーバを再起動します.

$ sudo service bluetooth restart

サーバは要rootのようです.
この状態でAndroid側からクライアントPCを選択して接続すればok.

$ sudo ~/.blink/bluetooth_server.py
READY FOR CONNECTIONS, RFCOMM channel 1
('INBOUND CONNECTION ', ('68:76:4F:3B:D1:E0', 1))
COMMAND RECEIVED [{"action":"mouse-move","x":null,"y":null}]
['xdotool', 'mousemove_relative', '--', 'None', 'None']
COMMAND RECEIVED [{"action":"mouse-move","x":-1,"y":0}]
['xdotool', 'mousemove_relative', '--', '-1', '0']
COMMAND RECEIVED [{"action":"mouse-move","x":0,"y":0}]
['xdotool', 'mousemove_relative', '0', '0']
COMMAND RECEIVED [{"action":"mouse-move","x":-1,"y":0}]
['xdotool', 'mousemove_relative', '--', '-1', '0']

上の方のモード切替スイッチをタップして規定の「Swipe Area」から「Mouse」にします.「Mouse Area」で操作するとxdotoolのログが大量に出つつ操作できます.

27629912281 e0ba729509 n
27094267013 3fb8577a76 n

操作は少し解りづらくてこんな感じです.

  • タップ→左クリック

  • タップ, ホールド, リリース → 右クリック

中クリックやドラッグは多分未実装で使えません.
カーソル移動はちらつきますがとりあえず使える感じです.

でも導入に要設定変更&要rootなのが面倒ですね.

]]>
https://matoken.org/blog/2016/06/17/want-the-android-terminal-to-the-touch-pad-instead-of-linux-blink-of-bluetooth-use/feed/ 0
awesomeとかでApple Wireless Trackpadを設定する https://matoken.org/blog/2016/06/17/to-set-the-apple-wireless-trackpad-at-awesomes/ https://matoken.org/blog/2016/06/17/to-set-the-apple-wireless-trackpad-at-awesomes/#respond Fri, 17 Jun 2016 13:31:36 +0000 http://matoken.org/blog/?p=1390

Bluetooth接続のApple Wireless Trackpadですが,GnomeとかだとBluetoothでペアリングした後こんな感じでGUIで設定できるのですが,

27082898093 594ed9ea4e n
27082898303 067a324e77 n
27414891970 2128414b0d n

awesomeだと効かないようです.ペアリングした後カーソル移動,2本指スクロール,右クリックはなどは動作するのですが,一番利用する左クリックが動作しません.

こいつはDynaptics driver用のコマンドのsynclientを使って設定内容の確認とアドホックな動作確認をします.
コマンドが存在しない場合 xserver-xorg-input-synaptics pkgを導入してください.
-l optionで設定項目の確認が出来ます.

$ synclient -l
Parameter settings:
    LeftEdge                = -2393
    RightEdge               = 2651
    TopEdge                 = -2030
    BottomEdge              = 2139
    FingerLow               = 70
    FingerHigh              = 75
    MaxTapTime              = 180
    MaxTapMove              = 346
    MaxDoubleTapTime        = 100
    SingleTapTimeout        = 180
    ClickTime               = 100
    EmulateMidButtonTime    = 0
    EmulateTwoFingerMinZ    = 100
    EmulateTwoFingerMinW    = 50
    VertScrollDelta         = 157
    HorizScrollDelta        = 157
    VertEdgeScroll          = 0
    HorizEdgeScroll         = 0
    CornerCoasting          = 0
    VertTwoFingerScroll     = 1
    HorizTwoFingerScroll    = 1
    MinSpeed                = 1
    MaxSpeed                = 1.75
    AccelFactor             = 0.0253743
    TouchpadOff             = 0
    LockedDrags             = 0
    LockedDragTimeout       = 5000
    RTCornerButton          = 0
    RBCornerButton          = 0
    LTCornerButton          = 0
    LBCornerButton          = 0
    TapButton1              = 0
    TapButton2              = 2
    TapButton3              = 3
    ClickFinger1            = 1
    ClickFinger2            = 3
    ClickFinger3            = 2
    CircularScrolling       = 1
    CircScrollDelta         = 0.1
    CircScrollTrigger       = 0
    CircularPad             = 0
    PalmDetect              = 1
    PalmMinWidth            = 10
    PalmMinZ                = 200
    CoastingSpeed           = 50
    CoastingFriction        = 50
    PressureMotionMinZ      = 30
    PressureMotionMaxZ      = 160
    PressureMotionMinFactor = 1
    PressureMotionMaxFactor = 1
    GrabEventDevice         = 0
    TapAndDragGesture       = 1
    AreaLeftEdge            = 0
    AreaRightEdge           = 0
    AreaTopEdge             = 0
    AreaBottomEdge          = 0
    HorizHysteresis         = 4
    VertHysteresis          = 4
    ClickPad                = 0
    RightButtonAreaLeft     = 0
    RightButtonAreaRight    = 0
    RightButtonAreaTop      = 0
    RightButtonAreaBottom   = 0
    MiddleButtonAreaLeft    = 0
    MiddleButtonAreaRight   = 0
    MiddleButtonAreaTop     = 0
    MiddleButtonAreaBottom  = 0

とりあえずタップの設定をしてみます.これでタップが出来るようになったら設定項目は当たりです.

$ synclient TapButton1=1
$ synclient -l|grep TapButton1
    TapButton1              = 1

設定項目が判ったら設定ファイルに書いておきます.
今回は /etc/X11/xorg.conf.d/21-apple-touchpad.conf にしました.
とりあえずタップの設定だけ以下のように設定しました.
ファイルの用意ができたらXの再起動を行います.awesomeの場合 Mod4 + Shift + q とかで一旦Xを終了してログインし直します.

Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        Option "TapButton1" "1" # 1本指タップを左クリックに
EndSection

他の設定項目も同様に設定していきます.
現在こんな感じにしています.

Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        Option "TapButton1" "1" # 1本指タップを左クリックに
        Option "TapButton2" "3" # 2本指タップを右クリックに
        Option "TapButton3" "2" # 3本指タップを中クリックに
        Option "VertTwoFingerScroll" "on"       # 縦スクロールを有効
        Option "HorizTwoFingerScroll" "on"      # 横スクロールを有効
        Option "PalmDetect" "1" # 手のひら検出
EndSection

今回Debian stretch testing amd64ですが他の環境でも同様に行けると思います.

$ screenfetch
         _,met$$$$$gg.           mk@x220
      ,g$$$$$$$$$$$$$$$P.        OS: Debian testing stretch
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.5.0-2-amd64
   ,$$P'              `$$$.      Uptime: 1d 12h 8m
  ',$$P       ,ggs.     `$$b:    Packages: 4379
  `d$$'     ,$P"'   .    $$$     Shell: bash 4.3.42
   $$P      d$'     ,    $$P     Resolution: 1366x768
   $$:      $$.   -    ,d$$'     WM: Awesome
   $$\;      Y$b._   _,d$P'      WM Theme: awesome
   Y$$.    `.`"Y$$$$P"'          CPU: Intel Core i5-2540M CPU @ 3.3GHz
   `$$b      "-.__               GPU: Mesa DRI Intel(R) Sandybridge Mobile
    `Y$$                         RAM: 4288MiB / 15934MiB
     `Y$$.
       `$$b.
         `Y$$b.
            `"Y$b._
                `""""

]]>
https://matoken.org/blog/2016/06/17/to-set-the-apple-wireless-trackpad-at-awesomes/feed/ 0
画像や動画をtextに変換するhiptextを試す https://matoken.org/blog/2016/06/01/try-hiptext/ https://matoken.org/blog/2016/06/01/try-hiptext/#respond Wed, 01 Jun 2016 04:26:52 +0000 http://matoken.org/blog/?p=1376

類似のものでlibcacaとかがありますが,

Turn images into text better than caca/aalib

とのことでもっといいものらしいです.
Texttop[1]で使われているので興味を持ったのですが,そのままではBuild出来なかったのでメモです.

build

READMEではこの辺が必要とのことです.

sudo apt-get install build-essential libpng12-dev libjpeg-dev \
    libfreetype6-dev libgif-dev ragel libavformat-dev libavcodec-dev \
    libswscale-dev libgflags-dev libgoogle-glog-dev

Debian stretch testingではこんな感じ?

$ sudo apt-get install build-essential libpng-dev libjpeg-dev \
      libfreetype6-dev libgif-dev ragel libavformat-dev libavcodec-dev \
      libswscale-dev libgflags-dev libgoogle-glog-dev

後はmakeするだけなんですが,こんなエラーが.新しいlibavに追従できてない感じ?

g++ -g -O3 -std=c++11 -Wall -Wextra -fno-exceptions -fno-rtti -MD  -march=native -c -o movie.o movie.cc
movie.cc: In member function ‘void Movie::PrepareRGB(int, int)’:
movie.cc:56:42: error: ‘PIX_FMT_RGB24’ was not declared in this scope
                       width_, height_, PIX_FMT_RGB24, SWS_FAST_BILINEAR,
                                          ^
In file included from graphic.h:10:0,
                 from movie.h:9,
                 from movie.cc:4:
movie.cc:64:38: error: ‘avcodec_alloc_frame’ was not declared in this scope
 CHECK(frame_ = avcodec_alloc_frame());
                                      ^
movie.cc:66:19: warning: ‘int avpicture_get_size(AVPixelFormat, int, int)’ is deprecated [-Wdeprecated-declarations]
   int rgb_bytes = avpicture_get_size(PIX_FMT_RGB24, width_, height_);
                   ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4898:5: note: declared here
 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
     ^
movie.cc:66:19: warning: ‘int avpicture_get_size(AVPixelFormat, int, int)’ is deprecated [-Wdeprecated-declarations]
   int rgb_bytes = avpicture_get_size(PIX_FMT_RGB24, width_, height_);
                   ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4898:5: note: declared here
 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
     ^
movie.cc:69:14: warning: ‘int avpicture_fill(AVPicture*, const uint8_t*, AVPixelFormat, int, int)’ is deprecated [-Wdeprecated-declarations]
   int prep = avpicture_fill(reinterpret_cast<AVPicture*>(frame_rgb_),
              ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4883:5: note: declared here
 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
     ^
movie.cc:69:14: warning: ‘int avpicture_fill(AVPicture*, const uint8_t*, AVPixelFormat, int, int)’ is deprecated [-Wdeprecated-declarations]
   int prep = avpicture_fill(reinterpret_cast<AVPicture*>(frame_rgb_),
              ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4883:5: note: declared here
 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
     ^
movie.cc: In member function ‘Graphic Movie::Next()’:
movie.cc:94:5: warning: ‘void av_free_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     av_free_packet(&packet);
     ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4040:6: note: declared here
 void av_free_packet(AVPacket *pkt);
      ^
movie.cc:94:5: warning: ‘void av_free_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     av_free_packet(&packet);
     ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4040:6: note: declared here
 void av_free_packet(AVPacket *pkt);
      ^
movie.cc:94:27: warning: ‘void av_free_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     av_free_packet(&packet);
                           ^
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:318:0,
                 from movie.cc:10:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4040:6: note: declared here
 void av_free_packet(AVPacket *pkt);
      ^
<ビルトイン>: ターゲット 'movie.o' のレシピで失敗しました
make: *** [movie.o] エラー 1

でも以下のPRを反映したら通りました :)

試してみる

サンプルとして,balls.jpg, obama.jpg があるのでこれを試してみます.
うまく動いていそうです.

47418

でも.pngはうまく動かない?

$ ./hiptext ~/Downloads/Tux.png
F0601 11:01:16.713266 30721 png.cc:35] Check failed: type == PNG_COLOR_TYPE_RGB || type == PNG_COLOR_TYPE_RGBA png bad type: /home/mk/Downloads/Tux.png
*** Check failure stack trace: ***
    @     0x7fa48d3c013d  google::LogMessage::Fail()
    @     0x7fa48d3c1fa3  google::LogMessage::SendToLog()
    @     0x7fa48d3bfccb  google::LogMessage::Flush()
    @     0x7fa48d3c298e  google::LogMessageFatal::~LogMessageFatal()
    @           0x41859f  LoadPNG()
    @           0x403fa8  main
    @     0x7fa489e59610  __libc_start_main
    @           0x40a229  _start
    @              (nil)  (unknown)
中止
$ convert ~/Downloads/Tux.png ./Tux.jpg
$ ./hiptext Tux.jpg

`.jpg`に変換したらいけてる感じですがなんか欠けてます.

26780171563 8d301b27a4

動画再生もいけます.再生のみで一時定位などの操作は出来ない感じ?

今のところlibcacaや動画ではvlcやmplayerなんかのほうがパッケージで導入できるのでお手軽そう.

とりあえず動くようになったので次はTexttopを試してみようと思います.

]]>
https://matoken.org/blog/2016/06/01/try-hiptext/feed/ 0
書き込み専用ぽいsamba共有を作る https://matoken.org/blog/2016/05/25/samba-write-only-share/ https://matoken.org/blog/2016/05/25/samba-write-only-share/#respond Wed, 25 May 2016 12:47:19 +0000 http://matoken.org/blog/?p=1366

書き込み専用の共有

sambaでデータの提出専用みたいな共有が作れないかと試してみました.

sambaサーバ の /etc/samba/smb.conf を編集して write-only という共有を作成.

[write-only]
  # 共有ファイルの保存先
  path = /export/data/write-only
  # 共有が見えるように
  browseable = yes
  # ゲストアクセス許可
  guest ok = yes
  guest only = yes
  # 書き込み可能
  writable = Yes
  # ゲストで書き込むと nobody アカウントで保存される
  guest account = nobody
  # umaskを 0333 に
  create mask = 0333
  directory mask = 0333
  # 読み込み権のないファイルを見えなくする
  hide unreadable = Yes

samba の設定を反映する

$ sudo service samba reload

クライアントPCから共有に接続して動作確認する

gvfs-mount で mount して,マウントポイントを確認.

$ gvfs-mount smb://192.168.1.102/write-only
$ mount|grep gvfs
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
client$ $ ls -la /run/user/1000/gvfs/smb-share\:server\=192.168.1.102\,share\=write-only/
合計 0
drwx------ 1 mk mk 0  5月 25 19:13 .
dr-x------ 3 mk mk 0  5月 21 05:54 ..

書き込んでみる

$ echo hoge > /run/user/1000/gvfs/smb-share\:server\=192.168.1.102\,share\=write-only/hoge

書き込んだファイルは見えない

$ ls -la /run/user/1000/gvfs/smb-share\:server\=192.168.1.102\,share\=write-only/
合計 0
drwx------ 1 mk mk 0  5月 25 19:24 .
dr-x------ 3 mk mk 0  5月 21 05:54 ..
$ cat /run/user/1000/gvfs/smb-share\:server\=192.168.1.102\,share\=write-only/hoge
$ cat: '/run/user/1000/gvfs/smb-share:server=192.168.1.102,share=write-only/hoge': 許可がありません

serverではこんな感じで見える

$ ls -lA /export/data/write-only
合計 4
--wx-w---- 1 nobody nogroup 5  5月 25 19:24 hoge
$ sudo cat /export/data/write-only/hoge
hoge

クライアントから同名のファイル名で上書きするとエラーもなく書き込める

$ echo fuga > /run/user/1000/gvfs/smb-share\:server\=192.168.1.102\,share\=write-only/hoge

サーバで書き換わっているのを確認

$ sudo cat /export/data/write-only/hoge
fuga



]]>
https://matoken.org/blog/2016/05/25/samba-write-only-share/feed/ 0
コンポジットマネージャーのXcompmgrでウィンドウ透過設定 https://matoken.org/blog/2016/03/20/window-transparent-set-in-xcompmgr-of-composite-manager/ https://matoken.org/blog/2016/03/20/window-transparent-set-in-xcompmgr-of-composite-manager/#comments Sat, 19 Mar 2016 23:03:09 +0000 http://matoken.org/blog/?p=1288

久々にMATE環境を使ってみています.
awesomeだとショートカットキーでウィンドウの配置を設定できるので簡単にウィンドウを並べ変えて動画を見ながら別のことをするといったことが簡単に出来ました.しかしMATEで同じことをしようとすると面倒.以前はGnome端末で背景を透過させていましたがこの機能はなくなっていました.

Gnome端末から無くなった後もMATE端末には透過機能が残っていましたがこちらからもいつの間にかなくなっていました.もう復活することは無さそうなので他の端末アプリを幾つか試してみましたが擬似透過しか見当たりません.

ということで今回はXcompmgrを試してみました.

前提

xorgでComposite, RENDER が有効になっている必要がああります.以下OKの例.

$ xdpyinfo | grep -i "render\|composite"
    Composite
    RENDER

必要パッケージの導入

コンポジットマネージャーのxcompmgrと,透過の設定をするtranssetの含まれたx11-appsを導入します.

$ sudo apt install xcompmgr x11-apps

コンポジットマネージャの起動

$ xcompmgr -c &

とか

$ xcompmgr -cf &

とか

$ xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 &

とかお好みで.

transsetでの透過

xcompmgrが起動した状態でtranssetを使うとウィドウを透過させることが出来ます.
引数には0~1の値を設定します.0が完全に透明.1が不透明です.

$ transset 0.6

として実行するとマウスカーソルが+マークになり,クリックしたウィンドウが透過されます.
以下はブラウザフルスクリーンでニコ生を再生した上に透過設定したMATE端末を表示しています.

Screenshot at 2016-03-19 07:06:39

自動起動設定

毎回手動で起動&設定するのは面倒なのでこんな感じで自動起動設定をします.
コンポジットマネージャーは「システム」->「設定」>「ユーザ向け」->「自動起動するアプリ」から.

Screenshot at 2016-03-20 06:27:22

MATE端末の透過設定は~/.bashrcに以下のように書いてbash起動時にMATE端末だったらtranssetを起動するようにしてみました.sleepを付けないとうまく動きませんでした.sleepの値は環境によって変わると思います.

$ tail -4 ~/.bashrc
case "$COLORTERM" in
    mate-terminal) sleep 0.3 && transset -a 0.6 > /dev/null;;
esac
 

ショートカット設定

MATE端末だけを透過設定する場合はここまでの設定で大丈夫ですが,他のウィンドウや透過度を変更するのにショートカット設定をしておくと便利そうです.

「システム」->「設定」->「ハードウェア」->「キーボードショートカット」でtranssetを登録してショートカットを設定します.

ここで設定したtranssetのオプションは-aはアクティブウィンドウの指定,--inc/--decはインクリメント,デクリメントのオプションです.

Screenshot at 2016-03-20 07:48:08Screenshot at 2016-03-20 07:48:03

Screenshot at 2016-03-20 06:25:27

これで未設定のアプリで透過させたり,ちょっと透過度を調整したいと行った時にショートカットですぐ設定できるようになりました :)

Screenshot at 2016-03-20 06:30:06







]]>
https://matoken.org/blog/2016/03/20/window-transparent-set-in-xcompmgr-of-composite-manager/feed/ 1
Radikoを自動的に録音してPodcast化してくれるradicastを試す https://matoken.org/blog/2016/03/09/try-the-automatically-recorded-me-turned-into-further-podcast-by-radicast-the-radiko/ https://matoken.org/blog/2016/03/09/try-the-automatically-recorded-me-turned-into-further-podcast-by-radicast-the-radiko/#respond Tue, 08 Mar 2016 23:26:15 +0000 http://matoken.org/blog/?p=1278

Radikoを自動的に録音してPodcast化してくれるradicastというものを見つけました.

昔はこんな感じで録音したりしていましたが仕様が変わって録音できなくなって対応というのが面倒で最近は録音していませんでした.たまに聞くときはAndroidのRazikoを使っています.でもradicastならお手軽に動かせてPodcastとして扱えるので便利そうということで試してみました.

試した環境はUbuntu 14.04 amd64/Debian stretch testing amd64/Rasbian jessieですが,Ubuntu環境では録音開始時に以下のようにコアダンプしてしまうようでうまく行っていません :-(

2016/03/09 05:20:00 [radiko] start record
2016/03/09 05:20:00 [radiko] GET http://radiko.jp/player/swf/player_3.0.0.01.swf
2016/03/09 05:20:04 [radiko] POST https://radiko.jp/v2/api/auth1_fms
Segmentation fault (コアダンプ)

dockerでも動きますが,今回は実機で動かしています.

必要なpkgの導入

$ sudo apt install libav-tools swftools rtmpdump golang-go

※Debian stretchの場合はlibav-toolsの代わりにffmpegを導入.

go getで導入

$ GOPATH=~/usr/local/go go get github.com/soh335/radicast

オプションはこんな感じでした.

$ ~/usr/local/go/bin/radicast -h
Usage of /home/mk/usr/local/go/bin/radicast:
  -bitrate string
        bitrate (default "64k")
  -buffer int
        buffer for recording (default 60)
  -config string
        path of config.json (default "config.json")
  -converter string
        ffmpeg or avconv. If not set this option, radicast search its automatically.
  -host string
        host (default "0.0.0.0")
  -output string
        output (default "output")
  -port string
        port (default "3355")
  -setup
        initialize json configuration
  -title string
        title (default "radicast")

設定ファイル作成

--setupオプションでスケルトンを作成して,

$ ~/usr/local/go/bin/radicast --setup > ~/usr/local/go/etc/radicast.json
$ cat ~/usr/local/go/etc/radicast.json
{
  "HOUSOU-DAIGAKU": [],
  "MBC": [],
  "RN1": [],
  "RN2": []
}

次のページを参考にcron形式で設定します.crontabと違い秒単位まで指定できるようです.

例えば"0 0 7 * * MON-FRI" だと月曜から金曜の07:00:00の番組を録音となります.
録音停止は自動的にされるようです.

$ cat ~/usr/local/go/etc/radicast.json
{
  "HOUSOU-DAIGAKU": [],
  "MBC": [
    "0 0 5 * * MON-FRI",
    "0 10 5 * * MON-FRI",
    "0 0 7 * * MON-FRI"
  ],
  "RN1": [],
  "RN2": []
}

実行

設定ファイルを指定して実行します.

$ ~/usr/local/go/bin/radicast -config=$HOME/usr/local/go/etc/radicast.json
2016/03/09 05:00:12 [radicast] station:MBC spec:0 0 5 * * MON-FRI
2016/03/09 05:00:12 [radicast] station:MBC spec:0 10 5 * * MON-FRI
2016/03/09 05:00:12 [radicast] station:MBC spec:0 0 7 * * MON-FRI
2016/03/09 05:00:12 [radicast] start new cron
2016/03/09 05:00:12 [server] start 0.0.0.0:3355

指定時刻になると,番組情報を取得して録音が始まり,番組終了時に録音が終了して次のジョブまで待機します.

2016/03/09 06:30:00 [radiko] start record
2016/03/09 06:30:00 [radiko] GET http://radiko.jp/player/swf/player_3.0.0.01.swf
2016/03/09 06:30:04 [radiko] POST https://radiko.jp/v2/api/auth1_fms
2016/03/09 06:30:05 [radiko] POST https://radiko.jp/v2/api/auth2_fms
2016/03/09 06:30:06 [radiko] GET http://radiko.jp/v2/api/program/today?area_id=JP46
2016/03/09 06:30:07 [radiko] start recording モーニング・スマイル
2016/03/09 06:30:07 [radiko] rtmpdump command: /usr/bin/rtmpdump --live --quiet -r rtmpe://f-radiko.smartstream.ne.jp --playpath simul-stream.stream --app MBC/_definst_ -W http://radiko.jp/player/swf/player_3.0.0.01.swf -C S:"" -C S:"" -C S:"" -C S:J_Rb9kLWN2Cb5XlcGqQjfw --stop 1853 -o -
2016/03/09 06:30:07 [radiko] converter command: /usr/bin/ffmpeg -y -i - -vn -acodec libmp3lame -ar 44100 -ab 64k -ac 2 /tmp/radiko240330221/radiko_0.mp3

データは以下のようにoutput以下に保存されています.

$ find output -ls
  6724248      0 drwxr-xr-x   1 mk       mk             36  3月  9 05:55 output
  6724778      0 drwxr-xr-x   1 mk       mk             44  3月  9 05:55 output/20160309053000_MBC
  6724327  10168 -rw-r--r--   1 mk       mk       10409132  3月  9 05:55 output/20160309053000_MBC/podcast.mp3
  6724779      4 -rw-r--r--   1 mk       mk            650  3月  9 05:55 output/20160309053000_MBC/podcast.xml

録音中のテンポラリファイルは/tmp以下に作られます.

$ ls -lA /tmp/radiko077215706/
合計 5184
-rw-r--r-- 1 mk mk 5223512  3月  9 07:10 radiko_0.mp3

録音したデータはPodcastとして配信されます.このURLは規定値ではlocalhostからしかアクセスできません.このURLをPodcast Aggregatorに指定してあげると普通にPodcastとして扱えます :)

$ xmllint http://localhost:3355/rss
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
    <channel>
        <title>radicast</title>
        <itunes:owner/>
        <itunes:image/>
        <itunes:category/>
        <item>
            <title>生島ヒロシのおはよう一直線 (2016-03-09 05:30:00 +0900 JST)</title>
            <itunes:author>生島ヒロシ</itunes:author>
            <itunes:summary> &lt;br /&gt;&lt;A href="http://www.mbc.co.jp/radio/" target="_blank"&gt;&lt;img src="http://www.mbc.co.jp/radio/radiko/bn/mbcradio_pr1410.png" alt="MBCradio" /&gt;&lt;/A&gt;&lt;br /&gt;&lt;br /&gt;twitterハッシュタグは「&lt;a href="http://twitter.com/#!/search/%23mbc1107"&gt;#mbc1107&lt;/a&gt;」</itunes:summary>
            <itunes:image/>
            <enclosure url="http://localhost:3355/podcast/20160309053000_MBC.mp3" length="10409132" type="audio/mpeg"/>
            <pubDate>Wed, 9 Mar 2016 05:55:45 +0900</pubDate>
        </item>
    </channel>
</rss>

Podcast Aggregatorとこのサーバが別の場合以下のように-hostオプションを指定してインターフェイスに割り当てたipを指定するとそのネットワークからアクセスできるようになります.

$ ~/usr/local/go/bin/radicast -config=$HOME/usr/local/go/etc/radicast.json -host 192.168.2.203
  :
2016/03/09 07:42:34 [server] start 192.168.2.203:3355

proxy

は使えない感じかな?

$ w3m -dump http://radiko.jp/area
document.write('<span class="JP46">KAGOSHIMA JAPAN</span>');
$ tsocks w3m -dump http://radiko.jp/area
document.write('<span class="JP13">TOKYO JAPAN</span>');
$ ALL_PROXY=socks5h://localhost:8080 ~/usr/local/go/bin/radicast -setup
2016/03/09 07:56:00 [radiko] GET http://radiko.jp/player/swf/player_3.0.0.01.swf
2016/03/09 07:56:01 [radiko] POST https://radiko.jp/v2/api/auth1_fms
2016/03/09 07:56:02 [radiko] POST https://radiko.jp/v2/api/auth2_fms
2016/03/09 07:56:02 [radiko] GET http://radiko.jp/v2/api/program/today?area_id=JP46
{
  "HOUSOU-DAIGAKU": [],
  "MBC": [],
  "RN1": [],
  "RN2": []
}
$ tsocks ~/usr/local/go/bin/radicast -setup
   :
  "MBC": [],
   :
$ tsocks ~/usr/local/go/bin/radicast -setup
   :
  "MBC": [],
   :
$ ALL_PROXY=http://localhost:8080 ~/usr/local/go/bin/radicast -setup
   :
  "MBC": [],
   :

]]>
https://matoken.org/blog/2016/03/09/try-the-automatically-recorded-me-turned-into-further-podcast-by-radicast-the-radiko/feed/ 0
ownCloudの同期が動かなくなって困る https://matoken.org/blog/2016/02/26/troubled-the-synchronization-of-owncloud-is-stuck/ https://matoken.org/blog/2016/02/26/troubled-the-synchronization-of-owncloud-is-stuck/#respond Fri, 26 Feb 2016 11:21:51 +0000 http://matoken.org/blog/?p=1226

ownCloudを便利に使っているのですが,ふと気づくと同期されていない.ステータスを見ると最後の同期が8時間前.タスクマネージャーのアイコンは!マークが付いて「不明な状態」となっています.

20160226_19:02:52-398

ログを見てもよくわからない.

WebやAndroidそして別のLinuxマシンは問題ないようです.ということは多分この端末の問題.
問題の環境はDebian stretch testing amd64のowncloud 7.0.12~dfsg-2です.

一旦ownCloudを終了して設定ファイルだけ退避(対象ファイルはそのまま)して設定を作りなおしてみました.

$ mv ./.local/share/data/ownCloud ./.local/share/data/ownCloud-backup
$ owncloud --logwindow

とりあえず同期出来たようです.

]]>
https://matoken.org/blog/2016/02/26/troubled-the-synchronization-of-owncloud-is-stuck/feed/ 0
ブートUSBメモリなどを作るmkusbを試してみる https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/ https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/#comments Wed, 24 Feb 2016 00:03:35 +0000 http://matoken.org/blog/?p=1207

USBメモリなどにisoを書き込んで起動デバイスを作れるとても便利なUNetbootinというツールがあります.
しかし,Debian jessie/stretchに入っていません.

なんでだろうとBTSを見るとうまく動かないバグがあるようです.(UEFI環境でNG?)

ざざっと眺めていてmkusbという同じようなツールがあるのを見かけたので試してみました.

環境

Debian stretch testing amd64です.

$ screenfetch
         _,met$$$$$gg.           mk@x220
      ,g$$$$$$$$$$$$$$$P.        OS: Debian testing-updates sid
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.3.0-1-amd64
   ,$$P'              `$$$.      Uptime: 9h 7m
  ',$$P       ,ggs.     `$$b:    Packages: 3622
  `d$$'     ,$P"'   .    $$$     Shell: bash 4.3.42
   $$P      d$'     ,    $$P     Resolution: 1366x768
   $$:      $$.   -    ,d$$'     WM: Awesome
   $$\;      Y$b._   _,d$P'      WM Theme: awesome
   Y$$.    `.`"Y$$$$P"'          CPU: Intel Core i5-2540M CPU @ 3.3GHz
   `$$b      "-.__               GPU: Mesa DRI Intel(R) Sandybridge Mobile
    `Y$$                         RAM: 9768MiB / 15934MiB
     `Y$$.                      
       `$$b.                    
         `Y$$b.                 
            `"Y$b._             
                `""""           
 

Ubuntuはppaがあります.DebianはUbuntuのppaが使えます.他のLinuxディストリビューションでは導入スクリプト( mkusb-installer )が用意されています.

導入(ppa)

source.listを登録します.apt edit-sourcesコマンドでdeb http://ppa.launchpad.net/mkusb/ppa/ubuntu trusty mainを登録します.

$ sudo apt edit-sources mkusb
$ sudo chmod +r /etc/apt/sources.list.d/mkusb.list
$ cat /etc/apt/sources.list.d/mkusb.list
# "mkusb/install-to-debian - Community Help Wiki"
https://help.ubuntu.com/community/mkusb/install-to-debian
deb http://ppa.launchpad.net/mkusb/ppa/ubuntu trusty main
$ gpg --keyserver keyserver.ubuntu.com --recv-keys 54B8C8AC
gpg: 鍵54B8C8ACをhkpからサーバkeyserver.ubuntu.comに要求
gpg: 鍵54B8C8AC: 公開鍵"Launchpad PPA for MKUSB"をインポートしました
gpg:           処理数の合計: 1
gpg:             インポート: 1  (RSA: 1)
$ gpg --fingerprint 54B8C8AC
pub   4096R/54B8C8AC 2014-08-14
 フィンガー・プリント = 29D7 6ADA 2D15 A87B F4C6  8B82 3729 8274 54B8 C8AC
uid                  Launchpad PPA for MKUSB
 
$ gpg -a --export 54B8C8AC | sudo apt-key add -
OK
$ apt-key list|grep -A1 54B8C8AC
pub   4096R/54B8C8AC 2014-08-14
uid                  Launchpad PPA for MKUSB

パッケージリストの更新とmkusbパッケージの導入

$ sudo apt update
$ sudo apt install mkusb mkusb-nox
$ dpkg -L mkusb
/.
/usr
/usr/share
/usr/share/mkusb
/usr/share/mkusb/mkusb-start
/usr/share/mkusb/restore
/usr/share/mkusb/mkusb-st2
/usr/share/mkusb/usb-pack_efi.tar.gz
/usr/share/mkusb/grub.cfg
/usr/share/mkusb/maybe-problems.txt
/usr/share/mkusb/backup
/usr/share/icons
/usr/share/icons/mkusb.svg
/usr/share/icons/hicolor
/usr/share/icons/hicolor/scalable
/usr/share/icons/hicolor/scalable/apps
/usr/share/icons/hicolor/scalable/apps/mkusb.svg
/usr/share/icons/hicolor/48x48
/usr/share/icons/hicolor/48x48/apps
/usr/share/icons/hicolor/48x48/apps/mkusb.png
/usr/share/doc
/usr/share/doc/mkusb
/usr/share/doc/mkusb/README.Debian
/usr/share/doc/mkusb/copyright
/usr/share/doc/mkusb/changelog.Debian.gz
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/mkusb.8.gz
/usr/share/applications
/usr/share/applications/mkusb.desktop
/usr/sbin
/usr/sbin/mkusb
$ dpkg -L mkusb-nox
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mkusb-nox
/usr/share/doc/mkusb-nox/copyright
/usr/share/doc/mkusb-nox/changelog.Debian.gz
/usr/sbin
/usr/sbin/mkusb-nox

実行例

メニューから起動するか,

$ sudo -H /usr/sbin/mkusb

のようにして起動します.書き込むイメージが決まっている場合は引数に指定できます.イメージには.gzや.xzも指定可能なので展開の手間が省けます.

$ sudo -H /usr/sbin/mkusb ./alpine-3.3.1-x86_64.iso

スプラッシュが出て,

20160224_06:02:32-32496
20160224_06:02:36-32565

メニューが出てきます.cloneやwipeも可能です.
20160224_06:02:45-32658

書き込み先のデバイスは間違えないようにしましょう.間違えるととても悲しいことになります.ちなみにSD Cardスロットの/dev/mmcblk0は検出されませんでした.USB-SDアダプタ経由だと出てきました.
20160224_06:02:26-868
20160224_06:02:43-1237

確認画面でチェックを入れて「Go」ボタンで書き込みが始まります.
20160224_06:02:05-2732
20160224_06:02:13-2827
20160224_06:02:17-2960

実行例(nox)

mkusb-noxコマンドを使うと端末で利用できます.nox版では複数のUSBメモリがある場合の選択方法はわかりませんでした.書き込むデバイスだけを差し込むようにするしか無いかもしれません.

$ sudo /usr/sbin/mkusb-nox ./alpine-3.3.1-x86_64.iso
The iso file SHOULD BE loop mounted on a temporary file READ-ONLY:
mount: /dev/loop0 is write-protected, mounting read-only
disk_name_type=label
default grsec|label grsec| _found_ in iso-file
default grsec|label grsec| _found_ in /dev/sdb
 Final checkpoint
Install to /dev/sdb? (y/n)
y
pv "alpine-3.3.1-x86_64.iso"| dd of=/dev/sdb bs=4096 ...
  82MiB 0:00:00 [ 205MiB/s] [========================================================================================================================>] 100%            
20992+0 records in
20992+0 records out
85983232 bytes (86 MB) copied, 4.84297 s, 17.8 MB/s
syncing the drive ...
The default grsec|label grsec| USB device is re-cloned  :-)

問題なく利用できる場合はUNetbootinの方がマルチプラットホームだし使いやすそうです.状況により使い分けるのがいいのかもしれません.

]]>
https://matoken.org/blog/2016/02/24/try-mkusb-to-make-such-as-a-boot-usb-memory/feed/ 1
cronに特化したPodcastアグリゲータ/ダウンローダのpodgetを試す https://matoken.org/blog/2016/02/19/try-podget-of-podcast-aggregator-downloader-that-specializes-in-cron/ https://matoken.org/blog/2016/02/19/try-podget-of-podcast-aggregator-downloader-that-specializes-in-cron/#respond Thu, 18 Feb 2016 23:01:18 +0000 http://matoken.org/blog/?p=1191

先日試したpodracerは何気に10年前のソフトでメンテナンスもされていないし,起動中に強制終了するとゴミが残って次から起動しなくなったりとかとか結構不満点が出てきました.

今は前処理を以下のようにして,

if [ $(pgrep podracer) ] ; then
  echo 'running podracer.'
  exit -1
fi
 
echo run podracer
if [ -f ~/.podracer/tempsub ] ; then
  rm ~/.podracer/tempsub
  echo 'rm tempsub'
fi

プレイリストもこんな感じで別に作ってます.

cd ~/podcasts
PODCASTLIST=($(cd ~/podcasts ; find . -mmin -$LISTTIME -type f -print0 | xargs -0n1 file | grep -i audio | cut -f1 -d:))
if [ ${#PODCASTLIST[@]} -eq 0 ] ; then
  echo 'podcast not found.'
  exit -1;
fi
 
echo num = ${#PODCASTLIST[@]}
ls -1tr ${PODCASTLIST[@]} > ~/podcasts/todayspodcast.m3u

後者はDebianの方にはバグ報告をしていますが音沙汰がない感じです.

他にないかなーと探して(apt-cache search podcast)podgetというものを見つけました.

$ apt show podget | grep -A99 Description:
 
Description: cron 用に最適化された Podcast アグリゲータ/ダウンローダ
 Podget はシンプルな podcast アグリゲータであり、定期的なバックグランドジョブ
 (すなわち cron) として起動するために最適化されています。RSS および XML フィード
 からの podcast のダウンロード、ファイルをソートしてフォルダやカテゴリごとに格納、
 iTunes PCAST ファイルおよび OPML リストからの URL のインポート、M3U および ASX
 プレイリストの自動生成、そして古くなったファイルの自動クリーンアップのサポート
 が特徴です。また、MS Windows サーバ上にホストされた podcast の UTF-16 自動変換も
 特徴です。
 podget を一旦起動すると、ユーザ設定ファイルを $HOME/.podget にインストール
 しますので、そのファイルをカスタマイズできます。

cronに特化していて便利そうなので試してみます.

導入

Debian stretch testing/Rasbian jessie/Ubuntu 14.04 で確認しました.

$ sudo apt install podget

初期化

$ podget -h
 
Usage /usr/bin/podget [options]
 
    -c --config <FILE>           Name of configuration file.
    -C --cleanup                 Skip downloading and only run cleanup loop.
    --cleanup_simulate           Skip downloading and simulate running
                                 cleanup loop.
                                 Display files to be deleted.
    --cleanup_days               Number of days to retain files.  Anything
                                 older will be removed.
    -d --dir_config <DIRECTORY>  Directory that configuration files are
                                 stored in.
    -f --force                   Force download of items from each feed even
                                 if they have already been downloaded.
    --import_opml <FILE or URL>  Import servers from OPML file or
                                 HTTP/FTP URL.
    --import_pcast <FILE or URL> Import servers from iTunes PCAST file or
                                 HTTP/FTP URL.
    -l --library <DIRECTORY>     Directory to store downloaded files in.
    -p --playlist-asx            In addition to the default M3U playlist,
                                 create an ASX Playlist.
    -r --recent <count>          Download only the <count> newest items from
                                 each feed.
    --serverlist <list>          Serverlist to use.
    -s --silent                  Run silently (for cron jobs).
    --verbosity <LEVEL>          Set verbosity level (0-4).
    -v                           Set verbosity to level 1.
    -vv                          Set verbosity to level 2.
    -vvv                         Set verbosity to level 3.
    -vvvv                        Set verbosity to level 4.
    -h --help                    Display help.

初回起動時に設定ファイルなどが作成されます.引数無しで実行すると初期設定の中のpodcastをダウンロードするので--cleanup_simulateオプションを付けて実行すると良さそうです.
設定ファイルは規定値では~/.podget以下に作成されます.

$ podget --cleanup_simulate
$ ls -lA ~/.podget
合計 8
-rw-rw-r-- 1 mk mk 3652  2月 19 05:34 podgetrc
-rw-rw-r-- 1 mk mk 1131  2月 19 05:34 serverlist
  • podgetrc : 設定ファイル
  • serverlist : podcastのリスト

設定ファイルの用意

お好みで設定ファイルの~/podgetrcを編集します.私は以下の辺りを書き換えました.

ログファイルを有効に

# Directory to store logs in
dir_log=/home/mk/POD/LOG

プレイリストの年月日の形式を書き換え

# Date format for new playlist names
date_format=+%Y-%m-%d

Podcastの取得数を3つに

# Most Recent
# 0  == download all new items.
# 1+ == download only the <count> most recent
most_recent=3

サーバリストの作成

取得するPodcastを~/.podget/serverlistに書いていきます.

書式はスペース区切りで

URL カテゴリー 番組名

になっています.podgetを実行した時に
カテゴリー/番組名/番組というふうにディレクトリが掘られます.
具体的にはこんな感じで書いていきます.

http://feeds.feedburner.com/weblogs/csc tech 電脳空間カウボーイズ
http://feeds.backspace.fm/backspacefm tech backspace.fm
http://www.joqr.co.jp/science-podcast/index.xml science 日立ハイテクプレゼンツ 大村正樹のサイエンスキッズ
http://www.tbsradio.jp/life/rss.xml etc 文化系トークラジオ Life
http://www.tbsradio.jp/cycle-r/index.xml bike ミラクル・サイクル・ライフ
http://sokoani.com/feed anime そこあに
  :

他のアプリケーションらの移行でOPMLファイルのエクスポートが可能な場合はそのファイルやURLを元にインポートできるようです.※未確認

$ podget --import_opml <FILE or URL>

若しくはPCAST形式(iTunes向け?)も同様に利用できるようです.※未確認

$ podget --import_pcast <FILE or URL>

OPML書き出しの機能もあります.但しこの機能は
Ubuntu 14.04の0.6.9にはなく,
Rasbian jessieの0.7.3,
Debian stretchの0.7.9には存在しました.

$ podget --export_opml /tmp/podcast.opml
podget
 
Session file not found.  Creating podget.22189 .
 
Export serverlist to OPML file: /tmp/podcast.opml
 
Closing session and removing lock file.
$ head /tmp/podcast.opml
<?xml version="1.0" encoding="utf-8" ?>
<opml version="1.0">
<head/>
<body>
<outline text="tech"><outline text="電脳空間カウボーイズ" type="rss" xmlUrl="http://feeds.feedburner.com/weblogs/csc" /></outline>
<outline text="tech"><outline text="backspace.fm" type="rss" xmlUrl="http://feeds.backspace.fm/backspacefm" /></outline>
<outline text="science"><outline text="日立ハイテクプレゼンツ 大村正樹のサイエンスキッズ" type="rss" xmlUrl="http://www.joqr.co.jp/science-podcast/index.xml" /></outline>
<outline text="etc"><outline text="文化系トークラジオ Life" type="rss" xmlUrl="http://www.tbsradio.jp/life/rss.xml" /></outline>
<outline text="bike"><outline text="ミラクル・サイクル・ライフ" type="rss" xmlUrl="http://www.tbsradio.jp/cycle-r/index.xml" /></outline>
<outline text="anime"><outline text="そこあに" type="rss" xmlUrl="http://sokoani.com/feed" /></outline>

実行

とりあえず引数無しで実行することでPodcastが取得できます.

$ podget
-------------------------------------------------
Category: anime         Name: そこあに
Downloading feed index from http://sokoani.com/feed
2016-02-19 07:37:15 URL:http://sokoani.com/feed [673868] -> "-" [1]
 
Downloading 0_s413.mp3 from http://sokoani.com/podpress_trac/feed/9818/0/
 :
 :

Podcastは規定値では~/POD以下にカテゴリ/番組名/番組ファイルの形で保存されます.

$ find ~/POD -type f | tail -3
/home/mk/POD/etc/JUNK 伊集院光 深夜の馬鹿力/files_20160216.mp3
/home/mk/POD/etc/JUNK 伊集院光 深夜の馬鹿力/files_20160202.mp3
/home/mk/POD/etc/JUNK 伊集院光 深夜の馬鹿力/files_20160209.mp3

また,~/POD/*.m3uとステプレイリストも作成されます.これは実行単位で作られるのかな?

$ ls -l ~/POD/*.m3u
-rw-rw-r-- 1 mk mk  946  2月 19 07:14 /home/mk/POD/New-2016-02-19.m3u
-rw-rw-r-- 1 mk mk 1924  2月 19 07:50 /home/mk/POD/New-2016-02-19.r2.m3u

うまく動作するようなら-sオプションを付けてcronに登録してあげると良さそうです.以下の例では毎時3分にpodgetを実行しています.

$ crontab -e
$ crontab -l | tail -2
# get podcast
3 * * * *       podget -s

podracerはPodcastを番組関係なく実行日のディレクトリに保存されてPodcast番組を探したりするのに不便でしたがpodgetだとカテゴリと番組でディレクトリが分かれるので便利です.
しばらく併用してみようと思います.

]]>
https://matoken.org/blog/2016/02/19/try-podget-of-podcast-aggregator-downloader-that-specializes-in-cron/feed/ 0
絵文字を入力する-Mozc&emojione-picker- https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/ https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/#comments Tue, 16 Feb 2016 22:55:08 +0000 http://matoken.org/blog/?p=1184

Linux環境での絵文字入力方法です.新しい方法を知ったので紹介してみます.

Mozc利用

これまではこの方法を使っていました.Mozcの設定で「Unicode 6 絵文字変換」にチェックを付けると利用できるようになります.

20160216_23:02:52-2121

「えもじ」とか「ねこ」とか入力して変換出来ます.

20160217_07:02:28-3105

辞書に登録することも出来ます.

20160217_07:02:07-5247

emojione-picker for Ubuntu

今回知ったUbuntu向けの絵文字ピッカーです.実行するとタスクバーに常駐して入力したい絵文字を選んでクリックするとその絵文字がクリップボードにコピーされるのでクリップボード貼り付けで入力できます.

20160217_07:02:45-12768

チキンがクリップボードにコピーされたところ.

20160217_07:02:11-16960

いちいちメニューを辿るのは面倒ですが,Recentに最近使った絵文字が入るのでよく使うものはここからアクセスできます.

20160217_07:02:42-17641

Debian stretch testing への導入例

Ubuntu用ですがstretchにも入りました.ちなみにパッケージ化して導入しなくてもとりあえず動かすだけならgit cloneした後cd emojione-picker-ubuntu ; ./emojione-pickerとかでも動きました.

$ sudo apt install equivsequivs gir1.2-rsvg-2.0
$ git clone https://github.com/gentakojima/emojione-picker-ubuntu.git
$ cd emojione-picker-ubuntu
$ equivs-build debian_package.ctl
$ sudo dpkg -i emojione-picker_0.1_all.deb

という感じでLinux環境でも結構快適に絵文字が入力できるようになってきました.しかし絵文字は楽しいのですが環境によって見え方が大幅に変わるので意図したように伝わっているかとかが不安でもあります…….

]]>
https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker/feed/ 2
絵文字を入力する-Mozc&emojione-picker- https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/ https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/#comments Tue, 16 Feb 2016 22:55:08 +0000 http://matoken.org/blog/?p=1184

Linux環境での絵文字入力方法です.新しい方法を知ったので紹介してみます.

Mozc利用

これまではこの方法を使っていました.Mozcの設定で「Unicode 6 絵文字変換」にチェックを付けると利用できるようになります.

20160216_23:02:52-2121

「えもじ」とか「ねこ」とか入力して変換出来ます.

20160217_07:02:28-3105

辞書に登録することも出来ます.

20160217_07:02:07-5247

emojione-picker for Ubuntu

今回知ったUbuntu向けの絵文字ピッカーです.実行するとタスクバーに常駐して入力したい絵文字を選んでクリックするとその絵文字がクリップボードにコピーされるのでクリップボード貼り付けで入力できます.

20160217_07:02:45-12768

チキンがクリップボードにコピーされたところ.

20160217_07:02:11-16960

いちいちメニューを辿るのは面倒ですが,Recentに最近使った絵文字が入るのでよく使うものはここからアクセスできます.

20160217_07:02:42-17641

Debian stretch testing への導入例

Ubuntu用ですがstretchにも入りました.ちなみにパッケージ化して導入しなくてもとりあえず動かすだけならgit cloneした後cd emojione-picker-ubuntu ; ./emojione-pickerとかでも動きました.

$ sudo apt install equivsequivs gir1.2-rsvg-2.0
$ git clone https://github.com/gentakojima/emojione-picker-ubuntu.git
$ cd emojione-picker-ubuntu
$ equivs-build debian_package.ctl
$ sudo dpkg -i emojione-picker_0.1_all.deb

という感じでLinux環境でも結構快適に絵文字が入力できるようになってきました.しかし絵文字は楽しいのですが環境によって見え方が大幅に変わるので意図したように伝わっているかとかが不安でもあります…….

]]>
https://matoken.org/blog/2016/02/17/to-enter-the-emoticons-mozce-and-mojione-picker-2/feed/ 2
GNU Coreutils 8.25でlsの出力が変わったのを試してみる https://matoken.org/blog/2016/02/17/try-out-the-output-of-the-ls-has-changed-in-gnu-coreutils-8-25/ https://matoken.org/blog/2016/02/17/try-out-the-output-of-the-ls-has-changed-in-gnu-coreutils-8-25/#respond Tue, 16 Feb 2016 16:15:40 +0000 http://matoken.org/blog/?p=1180

DebuanのMLで知ったのですが,Coreutils 8.25lsの出力結果が変わっています.

この変更はlsコマンドを使ったscriptなどが影響を受けそうと思ったのですが端末でのみの変更のようで一安心.
Debian stretch testingでちょっと試しに動かしてみました.
Debian jessie/Ubuntu 14.04以降も同じ手順で行けると思います.

開発環境の導入

$ sudo apt install build-essential
$ sudo apt build-dep coreutils

Coreutils 8.25の入手と署名確認

$ wget ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz.sig
$ gpg --verify coreutils-8.25.tar.xz.sig
gpg: 署名されたデータが'coreutils-8.25.tar.xz'にあると想定します
gpg: 2016年01月20日 20時17分46秒 JSTにRSA鍵ID 306037D9で施された署名
gpg: "Pádraig Brady <P@draigBrady.com>"からの正しい署名
gpg:                 別名"Pádraig Brady <pixelbeat@gnu.org>"
gpg: *警告*: この鍵は信用できる署名で証明されていません!
gpg:       この署名が所有者のものかどうかの検証手段がありません。
主鍵フィンガー・プリント: 6C37 DC12 121A 5006 BC1D  B804 DF6F D971 3060 37D9

展開とビルド

$ tar xf coreutils-8.25.tar.xz
$ cd coreutils-8.25
$ ./configure --prefix=$HOME/usr/local
$ make

端末でのlsの動作比較

今パスの通っているのは8.24で,src/ls8.25

$ ls --version
ls (GNU coreutils) 8.24
Copyright (C) 2015 Free Software Foundation, Inc.
ライセンス GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 
作者 Richard M. Stallman および David MacKenzie。
$ src/ls --version
ls (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 
Written by Richard M. Stallman and David MacKenzie.

スペースの含まれたファイルを作成してlsを実行すると8.25のlsでは'で括られる.

$ touch /tmp/hoge\ fuga
$ ls /tmp/hoge\ fuga
/tmp/hoge fuga
$ src/ls /tmp/hoge\ fuga
'/tmp/hoge fuga'

日本語は大丈夫だが,エスケープの必要な文字も括られる.

$ touch /tmp/日本語 /tmp/エスケープの必要な記号\?
$ src/ls /tmp/日本語 /tmp/他の記号\?
'/tmp/他の記号?'  /tmp/日本語

パイプでの動作確認

パイプを通るとこれまでどおりの動作

$ src/ls /tmp/hoge\ fuga | cat
/tmp/hoge fuga

なので,xargsなどで処理したい場合はこれまでどおり

$ src/ls /tmp/hoge\ fuga | xargs cat
cat: /tmp/hoge: そのようなファイルやディレクトリはありません
cat: fuga: そのようなファイルやディレクトリはありません
$ src/ls /tmp/hoge\ fuga | xargs -I{} cat "{}"

回避方法x3

$ src/ls --quoting-style=literal /tmp/hoge\ fuga /tmp/エスケープの必要な記号\?
/tmp/hoge fuga  /tmp/エスケープの必要な記号?
$ src/ls -N /tmp/hoge\ fuga /tmp/エスケープの必要な記号\?
/tmp/hoge fuga  /tmp/エスケープの必要な記号?
$ QUOTING_STYLE=literal src/ls /tmp/hoge\ fuga /tmp/エスケープの必要な記号\?
/tmp/hoge fuga  /tmp/エスケープの必要な記号?

ということでとりあえずこれまでと同じ動作をさせたい場合はQUOTING_STYLE=literalを設定したりls -Naliasを設定しておくといいみたいです.

$ echo 'export QUOTING_STYLE=literal' >> ~/.bashrc

or

$ echo "alias ls='ls -N'" >> ~/.bashrc~/.bashrc

#ところでCoreutils 8.25でまたコマンドが一つ増えていました.今回は覚えやすいけど

** New commands

base32 is added to complement the existing base64 command,
and encodes and decodes printable text as per RFC 4648.

<追記>

DebianではSeverity: serious(重要度:深刻)となってsidの8.25-2no_ls_quoting.patchが入ってrevertされたようです.

$ bin/ls --version|head -1
ls (GNU coreutils) 8.25
$ bin/ls /tmp/hoge\ fuga 
/tmp/hoge fuga
$ cat patches/no_ls_quoting.patch
Description: revert inconsistent ls quoting
 This is a revert of upstream commit 109b9220cead6e979d22d16327c4d9f8350431cc.
 Info changed to reflect current upstream intentions.
 
Bug-Debian: https://bugs.debian.org/813164
 
--- coreutils-8.25.orig/NEWS
+++ coreutils-8.25/NEWS
@@ -71,9 +71,6 @@ GNU coreutils NEWS
   df now prefers sources towards the root of a device when
   eliding duplicate bind mounted entries.
 
-  ls now quotes file names unambiguously and appropriate for use in a shell,
-  when outputting to a terminal.
-
   join, sort, uniq with --zero-terminated, now treat '\n' as a field delimiter.
 
 ** Improvements
--- coreutils-8.25.orig/doc/coreutils.texi
+++ coreutils-8.25/doc/coreutils.texi
@@ -7750,8 +7750,8 @@ this"} in the default C locale.  This lo
 
 You can specify the default value of the @option{--quoting-style} option
 with the environment variable @env{QUOTING_STYLE}@.  If that environment
-variable is not set, the default value is @samp{shell-escape} when the
-output is a terminal, and @samp{literal} otherwise.
+variable is not set, the default value is @samp{literal}, but this
+default may change to @samp{shell-escape} in a future version of this package.
 
 @item --show-control-chars
 @opindex --show-control-chars
--- coreutils-8.25.orig/src/ls.c
+++ coreutils-8.25/src/ls.c
@@ -1581,7 +1581,6 @@ decode_switches (int argc, char **argv)
       if (isatty (STDOUT_FILENO))
         {
           format = many_per_line;
-          set_quoting_style (NULL, shell_escape_quoting_style);
           /* See description of qmark_funny_chars, above.  */
           qmark_funny_chars = true;
         }

</追記>

]]>
https://matoken.org/blog/2016/02/17/try-out-the-output-of-the-ls-has-changed-in-gnu-coreutils-8-25/feed/ 0
gdm3とlightdmでログイン時にユーザを表示しないようにする https://matoken.org/blog/2016/02/16/do-not-want-to-see-the-user-at-the-time-of-login-in-gdm3-and-lightdm/ https://matoken.org/blog/2016/02/16/do-not-want-to-see-the-user-at-the-time-of-login-in-gdm3-and-lightdm/#respond Tue, 16 Feb 2016 11:32:58 +0000 http://matoken.org/blog/?p=1174

gdm3

先ずはgdm3から.
環境は,Debian stretch testing gdm3 3.18.0-2です.

/etc/gdm3/greeter.dconf-defaultsを編集して,[org/gnome/login-screen]セクションのdisable-user-list=trueのコメントを外して有効にする.

[org/gnome/login-screen]
disable-user-list=true

その後gdm3を再起動.

$ sudo systemctl stop gdm
$ sudo systemctl start gdm

#初め/etc/gdm3/greeter.dconf-defaultsはテンプレートなのかと思って/etc/gdm3/greeter.dconfにコピーして編集して反映されないなーとやっていましたorz

LightDM

LightDMの場合.
環境は,Debian stretch testing lightdm 1.16.6-1です.

/etc/lightdm/lightdm.conf[LightDM]セクションのgreeter-hide-users=trueのコメントを外して有効にする.

greeter-hide-users=true

--show-configオプションで設定が確認できます.

$ /usr/sbin/lightdm --show-config
   [Seat:*]
A  greeter-session=lightdm-greeter
A  greeter-hide-users=true
A  session-wrapper=/etc/X11/Xsession
B  user-session=kde-plasma-kf5

   [LightDM]
C  greeter-hide-users=True
C  allow-guest=False

   [XDMCPServer]
C  enabled=true

Sources:
A  /usr/share/lightdm/lightdm.conf.d/01_debian.conf
B  /usr/share/lightdm/lightdm.conf.d/40-kde-plasma-kf5.conf
C  /etc/lightdm/lightdm.conf

その後LightDMの再起動.

$ sudo systemctl stop lightdm
$ sudo systemctl start lightdm

ディスプレイマネージャの切り替え

dpkg-reconfigureに導入済みのディスプレイマネージャのパッケージ名(どれでも)を付けて起動すると,導入済みのディプレイマネージャから選択できます.

$ sudo dpkg-reconfigure gdm3
 ┌─────────────────────────────────────────────────────────────────────┤ gdm3 を設定しています ├─────────────────────────────────────────────────────────────────────┐  
 │ ディスプレイマネージャとは、X Window System 上でのグラフィカルなログイン機能を提供するものです。                                                                  │  
 │                                                                                                                                                                   │  
 │ ひとつの X サーバを管理できるのはひとつのディスプレイマネージャだけですが、ディスプレイマネージャパッケージが複数インストールされています。どのディスプレイマネ   │  
 │ ージャをデフォルトで起動させるか選択して下さい。                                                                                                                  │  
 │                                                                                                                                                                   │  
 │ 異なるサーバを担当するように設定すれば、複数のディスプレイサーバは同時に動作できます。そのようにするには、/etc/init.d にある各ディスプレイマネージャの初期化スク  │  
 │ リプトを編集し、デフォルトディスプレイマネージャのチェックを無効にして下さい。                                                                                    │  
 │                                                                                                                                                                   │  
 │ デフォルトのディスプレイマネージャ:                                                                                                                               │  
 │                                                                                                                                                                   │  
 │                                                                              gdm3                                                                                 │  
 │                                                                              lightdm                                                                              │  
 │                                                                              sddm                                                                                 │  
 │                                                                                                                                                                   │  
 │                                                                                                                                                                   │  
 │                                                                              <了解>                                                                               │  
 │                                                                                                                                                                   │  
 └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘  

]]>
https://matoken.org/blog/2016/02/16/do-not-want-to-see-the-user-at-the-time-of-login-in-gdm3-and-lightdm/feed/ 0
色温度を自動的に変更して健康に気を使う(ブルーライトカット) https://matoken.org/blog/2016/02/11/use-care-to-health-by-changing-the-color-temperature-automatically-blue-light-cut/ https://matoken.org/blog/2016/02/11/use-care-to-health-by-changing-the-color-temperature-automatically-blue-light-cut/#respond Thu, 11 Feb 2016 10:06:23 +0000 http://matoken.org/blog/?p=1140

backspace.fmでドリキンさんがf.luxがいいと言っているのを聞いて以前Linux環境でブルーライトカット系のアプリを少し試したのを思い出しました.

その時はdebianでf.luxは自分でリポジトリを登録するのが面倒でパッケージの用意されているgnome-shell-extension-redshiftredshiftを試してみたのでした.f.luxインスパイアらしいし.
これらはf.luxと同じようにネットワーク情報から位置情報を取得し,端末の場所の太陽の位置により色温度を変化させるアプリケーションです.夜は色温度を低くしてブルーライトを軽減させます.これによりブルーライトを睡眠前に受ける量が減って寝つきやすくなったり睡眠の質が良くなるかもという効果を期待しています.
しかし,gnome-shell-extension-redshiftはうまく有効にならず,redshiftは位置情報の取得に失敗して手動で動作させていたのでした.

今回もdebian環境でredshift-gtkを試してみました.これは実体はredshiftでタスクトレイに常駐するものです.一時的にon/offすることも簡単に出来るので便利です.

実行するとタスクトレイに電球と月のアイコンが表示されます.クリックすると以下のようなメーニューが.
20160211_06:02:18-13459

画像編集などで一時的に機能を切りたい場合などサスペンドする機能もあります.
20160211_06:02:31-13554

インフォメーションの表示.朝6時頃なので色温度がだんだん高くなっていくところです.
20160211_06:02:28-4511

設定ファイルの作成

規定値で動作させてもだいたい問題ないのですが,カスタマイズしたかったり位置情報が誤った場所のものになっている場合など設定を変更したくなることがあります.
redshiftをコマンドで実行する場合はオプションが指定できますが,redshift-gtkの場合は設定ファイルで指定可能です.
場所は~/.config/redshift.confです.;以降はコメントとして扱われるようです.

メインとなる[redshift]セクションの説明です.

  • temp-day : 昼間の色温度,規定値は5500
  • temp-night : 夜間の色温度,規定値は3700
  • transition : スムーズな遷移の無効有効の設定(0 or 1)
  • brightness-day : 昼間のブライトネス設定(0.1~1.0)
  • brightness-night : 夜間のブライトネス設定(0.1~1.0)
  • gamma : ガンマ値の設定(0.1~10.0)
  • adjustment-method : 調整方法の選択
$ redshift -m list
Available adjustment methods:
  drm
  randr
  vidmode
  dummy
 
Specify colon-separated options with `-m METHOD:OPTIONS'.
Try `-m METHOD:help' for help.
  • location-provider : ロケーションプロバイダの指定.listオプションで確認できます.現在はgeoclue2とmanualが選べるようです.
$ redshift -l list
Available location providers:
  geoclue2
  manual
 
Specify colon-separated options with`-l PROVIDER:OPTIONS'.
Try `-l PROVIDER:help' for help.

adjustment-methodを指定した場合それぞれのセクションでオプションを指定可能です.
内容は$ redshift -m randr:helpのようにメソッド名:helpで確認できます.

[redshift]
 :
adjustment-method=randr
 :
[randr]
screen=1

location-providermanualにした場合[manual]セクションで緯度経度を指定します.度.分のみで秒まで指定するとエラーとなります.
以下は鹿児島県の場合です.

[manual]
lat=31.33
lon=130.33

ということで今こんな感じで使っています.

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3600
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature
transition=1
; Set the screen brightness. Default is 1.0
;brightness=0.9
; It is also possible to use different settings for day and night since version 1.8.
brightness-day=0.9
brightness-night=0.7
; Set the screen gamma (for all colors, or each color channel individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; Set the location-provider: 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values
; The location provider settings are in a different section.
location-provider=manual
 
; Set the adjustment-method: 'drm', 'randr', 'vidmode', 'dummy'
; type 'redshift -m list' to see all possible values
; The adjustment method settings are in a different section.
adjustment-method=randr
 
; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 0.
; Note that the numbering starts from 0, so this is actually the second screen.
[randr]
screen=0
 
; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings
; e.g. 'redshift -l manual:help'
[manual]
; kagoshima, japan
lat=31.33
lon=130.33

問題点?

redshiftを動かしているとブライトネスもこれで管理されます.手動で設定してもすぐにredshiftの設定に戻ります.バッテリー駆動中でブライトネスを下げてバッテリーの持ちを良くしようというような場合は困ります.とりあえずredshiftもブライトネスも手動設定して回避しています.

redshift-gtkを終了した状態で手動設定

$ redshift -O 3500
$ xrandr --output LVDS1 --brightness 0.3

それと夜ふかしさんのためにブルーライトカットの時間をずらす機能はないかなと思ったのですが見当たりませんでした.これは位置情報をmanualで設定して時差のある場所を設定するようにしたら実現できそうです.

]]>
https://matoken.org/blog/2016/02/11/use-care-to-health-by-changing-the-color-temperature-automatically-blue-light-cut/feed/ 0
コマンドで添付ファイル付きメールを送る2つの方法 https://matoken.org/blog/2016/02/09/two-of-how-to-send-attachments-with-e-mail-in-the-mail-command/ https://matoken.org/blog/2016/02/09/two-of-how-to-send-attachments-with-e-mail-in-the-mail-command/#respond Tue, 09 Feb 2016 03:17:43 +0000 http://matoken.org/blog/?p=1129

Google+でmailコマンドで添付ファイル付きメールを送ろうとしている方の投稿のコメントにbase64でデコードして送るscriptを使ってますとか書いたのですが,これperl4でcgi全盛な大昔からやってる手法なので楽なものがあるのではと思い探してみました.

Debian stretch testingのs-nailを使う

Debian stretch testing/sid ではmailコマンドがbsd-mailxからs-nailに変わって添付ファイルオプションがあるようです.

 -a file     Attach the given file to the message.  The same filename conventions as described in the section COMMANDS apply: shell word expansion is
             restricted to the tilde ‘~’ and variables.  Shall file not be accessible but contain a ‘=’ character, then anything after the ‘=’ is assumed to
             specify the input character set and anything before ‘=’ the filename: this is the only option to specify the input character set (and don't per‐
             form any character set conversion) for text attachments from the command line, not using the ~@ tilde escape command.

こんな感じで使えました.

$ echo 'attach test(binary)' | mail -s "attach test mail" -a ./text.xz matoken@gmail.com

#はじめ.zipを送ろうとしてgmailサーバに弾かれました.そういえばそうだった……
##sendmail: 552 5.7.0 content and attachment content guidelines. xu1sm1469539pab.31 - gsmtp

普通にメール送るのに加えて-aオプションでファイルを指定する感じです.
オプションでSMTPサーバの指定も出来るようなのでMTAの設定をしていないような場合でも単体で使えそうです.

Debian jessieでbiabamを使う

s-nailはstretch testingからでjessieには入っていないようです.代わりに入っているのはbsd-mailxです.manをちょっと見た感じでは添付ファイルの扱いは載っていなさそう.でもきっと便利な何かがあるのでは?とapt-cache search mail attachとかして探してみるとbiabamというbash script製のものを発見.小さいし良さそうと試してみました.

biabam – bash attachment mailer

こんな感じで使えました.

$ sudo apt install biabam
$ echo 'attach test' | biabam ./test.xz -s "attach test from jessie" matoken@gmail.com

ちなみにmailコマンドで添付ファイルの方法を検索すると大抵mutt使う例が出てきますが,muttを既に設定済みの人でないと敷居が高いと思います.そういう場合に今回の方法はいいのではないかと思います.

しかし恐らく多国言語対応はして居なさそうなので日本語をSubjectやBODYに使う場合は素直にScriptを書いたほうがいいかもしれません…….
定形なら適当なMUAでメールのテンプレートファイルを作っておいて流し込んでmailコマンドに投げるようにしてもいいですね.




]]>
https://matoken.org/blog/2016/02/09/two-of-how-to-send-attachments-with-e-mail-in-the-mail-command/feed/ 0
Tailsの導入にtails-installパッケージが便利 https://matoken.org/blog/2016/02/09/tails-install-package-is-convenient-to-the-introduction-of-tails/ https://matoken.org/blog/2016/02/09/tails-install-package-is-convenient-to-the-introduction-of-tails/#comments Mon, 08 Feb 2016 23:51:42 +0000 http://matoken.org/blog/?p=1125 手元のUSBメモリに導入してあるTailsを最新にしようと思い立ちダウンロードしつつ導入ページを見てみると新しくなっていました.

これまではisoファイルを入手した後USBメモリその1に導入.その後USBメモリその1から起動したTailsから運用したいUSBメモリその2に導入する必要がありました.
(USBメモリその1はカスタマイズなどが出来なかったはず)

次のページがその方法の解説ページです.

しかし,DebianとUbuntu向けにインストーラが用意されていました.これを利用するとインストールのためのUSBメモリが必要なくisoファイルからUSBメモリに導入するだけでOKになっていました.

これは便利と早速試してみました.

Tailsの入手

次のページから入手出来ます.私はbittorrent経由で入手しました.ダウンロードの完了に1時間と少し掛かりました.

ダウンロードが済んだら署名確認をします.
公開鍵を持っていない場合はダウンロードページの下のTails signing keyという画像から入手してインポートします.

$ wget -qO - https://tails.boum.org/tails-signing.key | gpg --import /dev/stdin
gpg: 鍵58ACD84F: 公開鍵"Tails developers (offline long-term identity key) <tails@boum.org>"をインポートしました
gpg:           処理数の合計: 1
gpg:             インポート: 1  (RSA: 1)
gpg: 最小の「ある程度の信用」3、最小の「全面的信用」1、PGP信用モデル
gpg: 深さ: 0  有効性:  15  署名:  53  信用: 0-, 0q, 0n, 0m, 0f, 15u
gpg: 深さ: 1  有効性:  53  署名:  60  信用: 53-, 0q, 0n, 0m, 0f, 0u
gpg: 次回の信用データベース検査は、2016-02-19です

その後署名確認をします.

$ gpg --verify tails-i386-2.0.iso.sig
gpg: 署名されたデータが'tails-i386-2.0.iso'にあると想定します
gpg: 2016年01月26日 09時07分15秒 JSTにRSA鍵ID 752A3DB6で施された署名
gpg: "Tails developers (offline long-term identity key) <tails@boum.org>"からの正しい署名
gpg:                 別名"Tails developers <tails@boum.org>"
gpg: *警告*: この鍵は信用できる署名で証明されていません!
gpg:       この署名が所有者のものかどうかの検証手段がありません。
主鍵フィンガー・プリント: A490 D0F4 D311 A415 3E2B  B7CA DBB8 02B2 58AC D84F
副鍵フィンガー・プリント: BA2C 222F 44AC 00ED 9899  3893 98FE C6BC 752A 3DB6

tails-installerの導入

tails-installerパッケージを導入します.tails-installerパッケージはDebianではjessie-backports以降に用意されています.

jessieでbackportsを設定していない人は次のページを参考に設定して下さい.

今回はstretch(testing)なのでパッケージの導入だけです.

$ sudo apt install tails-installer

tails-installertails-installerを使ったTailsの導入

メニューからやコマンドラインからtails-installer-launcherを実行します.ちなみにawesome wm環境だと認証がうまく動かないようです.

<脱線>

以下のコマンドの実行に問題がありました: `/usr/bin/pkexec /usr/bin/syslinux  -d syslinux /dev/sdb1`。
詳細なエラーログは  '/tmp/tails-installer-ddjZmh' に書かれています。
Tails installation failed!
以下のコマンドの実行に問題がありました: `/usr/bin/pkexec /usr/bin/syslinux  -d syslinux /dev/sdb1`。
詳細なエラーログは  '/tmp/tails-installer-ddjZmh' に書かれています。

このログを見ると以下のようなエラーが記録されていました.syslinux実行時に/dev/ttyが見つからないと言っているようです.

/usr/bin/pkexec /usr/bin/syslinux  -d syslinux /dev/sdb1
Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address

端末から実行すると認証が走りました.多分上のエラーはこの認証を呼ぼうとしてどこに呼べばいいのか解らなかったんでしょうね.

$ LANG=C tails-installer-launcher
    :
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/syslinux' as the super user
Authenticating as: KenichiroMATOHARA,,, (mk)
Password:
==== AUTHENTICATION FAILED ===

しかし3回ほど試しましたがここの認証も正しいパスワードを入力しても失敗してしまうよう…….

</脱線>

とりあえずpolicykitのちゃんと動いているGnomeなどの環境では問題ない&policykitが動かない場合は`gksudo`経由で実行すればOKです.

$ gksudo tails-installer-launcher

InstallとUpgradeが選択できます.Installを選択した場合は新規インストールで既存のデータは消されるので注意が必要です.Upgradeを選択すると既に持っているTailsのメディアのアップグレードが出来ます.

20160209_05:02:03-18344

署名確認をしたisoファイルと導入先のデバイス(USBメモリ等)を指定してInstall Tailsを選択します.

20160209_05:02:22-18509

確認画面が出て,OKボタンを押すと初期化や展開が始まります.しばらく待ちましょう.

20160209_05:02:28-18561

以下の画面が表示されたら完了です.

20160209_06:02:51-24618

UNetbootin並にお手軽です.Debian/UbuntuとTailsを利用している方におすすめです :)
#そういえばUNetbootinはjessie以降から居なくなってる. > Debian Package Tracking System – unetbootin






]]>
https://matoken.org/blog/2016/02/09/tails-install-package-is-convenient-to-the-introduction-of-tails/feed/ 1
Debian stretch環境でSilverlight動画を視聴 https://matoken.org/blog/2016/02/02/watch-the-silverlight-video-on-debian-stretch-environment/ https://matoken.org/blog/2016/02/02/watch-the-silverlight-video-on-debian-stretch-environment/#respond Tue, 02 Feb 2016 09:45:54 +0000 http://matoken.org/blog/?p=1106 確か1話はニコニコ動画で見たと思うハルチカですが,2話からは有料のよう.どこかで見られないかなーとON AIR情報を調べてみると「Rakuten SHOWTIME」というところで最新話が1週無料のようです.

Rakuten SHOWTIME
(最新各話、配信後1週間無料) http://video.rakuten.co.jp/

早速見に行くと,

非対応デバイスのため、動画を再生できません。

ブラウザのUser-Agentを変更してアクセスしてみると,Silverlightでした.

動画を再生するためには、Silverlightのインストールが必要です。こちらから最新版のインストールをお願いいたします。

Silverlightでの動画視聴は以前Pipelightを使って試したことがありました.

このときは動画と音声がどんどんずれていって動画視聴は辛かったです.今なら改善されているかもと再度試してみました.

以前はPipelightはDebian pkgにあったのですが今はなくなっているようです.

$ w3m -dump 'https://packages.debian.org/search?keywords=pipelight&searchon=all&exact=1&suite=all&section=all'|grep 'で検索しました' -A5
すべてのアーキテクチャで検索しました。
 
残念ながら、検索結果はありませんでした
 
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

公式ページを見ると導入手順が書かれていました.

今回はDebian stretchなのでこちらのページを参考に導入しました.

i386パッケージを有効にします.

$ sudo dpkg --add-architecture i386

リポジトリの鍵を入手して登録します.

wget http://repos.fds-team.de/Release.key
sudo apt-key add Release.key

pipelightのsource listを追加します.

$ sudo apt edit-sources pipelight
$ sudo cat /etc/apt/sources.list.d/pipelight.list
deb http://repos.fds-team.de/stable/debian/ stretch main

<追記>
apt-cache searchなどが一般ユーザでできなくなるので読み込み権を追加.

$ sudo chmod o+r /etc/apt/sources.list.d/pipelight.list

</追記>

パッケージ情報を更新してPipelightを導入します.

$ sudo apt update && sudo apt upgrade
$ sudo apt install pipelight-multi

プラグインデータベースを最新にします.

$ sudo pipelight-plugin --update

とりあえずPipelightの導入は完了です.続いてプラグインの有効化を行います.
ここからは以下のページを参考にします.
Pipelight | Installation

pipelight-pluginコマンドで利用できるプラグインの種類が確認できます.

$ pipelight-plugin
 
Usage: pipelight-plugin [OPTIONS ...] COMMAND
 
Environment variables:
  MOZ_PLUGIN_PATH             overwrite plugin path
 
Options:
  --accept                    accept all licenses
 
User commands:
  --enable  PLUGIN            enable plugin
  --disable PLUGIN            disable plugin
  --disable-all               disable all plugins
  --list-enabled              list enabled plugins for the current user
  --list-enabled-all          list all enabled plugins
  --show-license              print license for plugin
  --system-check              do a system check
  --help                      shows this help
  --version                   shows the current version of Pipelight
 
Global commands (require root rights):
  --create-mozilla-plugins    create copies of libpipelight.so
  --remove-mozilla-plugins    remove copies of libpipelight.so
  --unlock PLUGIN             unlocks an additional plugin
  --lock   PLUGIN             locks an additional plugin
  --update                    update the dependency-installer script
 
 
Supported standard plugins:
  silverlight5.1
  silverlight5.0
  silverlight4
  flash
  unity3d
  widevine
 
Additional plugins (experimental):
  shockwave
  foxitpdf
  grandstream
  adobereader
  hikvision
  npactivex
  roblox
  vizzedrgr
  viewright-caiway
  x64-unity3d
  x64-flash
 

今回はSilverlightを使いたいのでsilverlight5.1を有効にします.

$ sudo pipelight-plugin --enable silverlight5.1

ブラウザ(Iceweasel)で利用できるようにします,

$ sudo pipelight-plugin --create-mozilla-plugins

ブラウザ(Iceweasel)を起動して,about:pluginsにアクセスしてプラグインが読み込まれているか確認します.

20160202_16:02:32-30774

うまくいったようなので動画視聴を試してみます.2番組試してみましたが以前と違いズレも発生せず快適に視聴できました.機能も一通り試してみましたが,最大化も含め全て問題なく動いているようです.

20160202_15:02:03-9643

ということでハルチカが見られるようになりました :)




]]>
https://matoken.org/blog/2016/02/02/watch-the-silverlight-video-on-debian-stretch-environment/feed/ 0
aptコマンドのedit-sourcesオプションが便利 https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/ https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/#comments Mon, 01 Feb 2016 10:25:20 +0000 http://matoken.org/blog/?p=1102

Rasbianのパッケージサーバにjaistを指定していたのだけど最近遅いのでmirror listを見て

$ w3m -dump https://www.raspbian.org/RaspbianMirrors|grep -i japan -A1
Asia^*    Japan       JAIST                    (http|rsync)://ftp.jaist.ac.jp/pub/
                                               Linux/raspbian-archive/raspbian
--
Asia^*    Japan       WIDE Project Tsukuba NOC raspbian/raspbian/
                                               rsync://ftp.tsukuba.wide.ad.jp/
--
Asia^*    Japan       Yamagata University      http://ftp.yz.yamagata-u.ac.jp/pub/
                                               linux/raspbian/raspbian/

/etc/apt/sources.listをWIDEに変更した.

-deb http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian/ jessie main contrib non-free rpi
-deb-src http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian/ jessie main contrib non-free rpi
+deb http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian/  jessie main contrib non-free rpi
+deb-src http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian/  jessie main contrib non-free rpi

ところでaptコマンドのedit-sourcesオプションが便利なのでぜひ使うべき.visudoとかみたいに間違えると教えてくれる.

$ sudo apt edit-sources
E: Type 'eb' is not known on line 3 in source list /etc/apt/sources.list
Failed to parse /etc/apt/sources.list. Edit again?  [Y/n]

引数を付けて/etc/apt/sources.list.d/以下の編集も出来る

$ ls /etc/apt/sources.list.d/
google-chrome.list  gyazo_gyazo-for-linux.list  owncloud-client.list
$ sudo apt edit-sources owncloud-client

Debian jessie以降,Rasbian jessie以降,Ubuntu vivid(15.04)以降でそれぞれ利用可能だと思う.

apt (0.9.13.1) unstable; urgency=low
 
  [ Colin Watson ]
  * fix "apt-get  --purge build-dep" (closes: #720597)
  * fix regression that APT::Keep-Fds is not honored (closes: #730490)
 
  [ Michael Vogt ]
  * add "-f" option to "build-dep" as sbuild is using it to fix
    regression with cross-building (LP: #1255806)
  * add autopkgtest support for the integration testsuite
  * merge mvo/feature/short-list
  * merge mvo/feature/edit-sources
  * fix segfault in pkgDepCache::SetCandidateRelease() (closes: #709560)
  * reset terminal on error (closes: #730795)
  * fix apport report writing (LP: #1254499)
 
 -- Michael Vogt <mvo@debian.org>  Fri, 29 Nov 2013 20:50:17 +0100


]]>
https://matoken.org/blog/2016/02/01/convenient-edit-sources-option-of-apt-command/feed/ 1
Debian の Steam が起動しなくなったので調べる https://matoken.org/blog/2016/01/28/debian-of-steam-does-not-start-up/ https://matoken.org/blog/2016/01/28/debian-of-steam-does-not-start-up/#respond Thu, 28 Jan 2016 13:16:58 +0000 http://matoken.org/blog/?p=1086

Debian stretch testing amd64 で steam:i386 パッケージで導入した Steam が起動しなくなっていました.

端末で直に叩くとこんな感じで怒られていました.

$ steam
find: The relative path '~/usr/local/bin' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find.  Please remove that entry from $PATH

PATH から ~/usr/local/bin を抜くとOK
PATH を /home/user/usr/local/bin としてもOK
てことで ~/.profile の ~ を $HOME に書き換えました.

- PATH="~/usr/local/bin:$PATH"
+ PATH="$HOME/usr/local/bin:$PATH"

とりあえずこれで動くようになりました.

Steam では最近は Unturned とかで遊んでいます.最近は Linux で動くゲームも増えて嬉しいです :)

]]>
https://matoken.org/blog/2016/01/28/debian-of-steam-does-not-start-up/feed/ 0
CLI な podcast aggregator/downloader な podracer を試してみる https://matoken.org/blog/2016/01/28/try-the-cli-of-podcat-aggregator-downloader-of-podracer/ https://matoken.org/blog/2016/01/28/try-the-cli-of-podcat-aggregator-downloader-of-podracer/#comments Thu, 28 Jan 2016 05:42:30 +0000 http://matoken.org/blog/?p=1080

podcast aggregator に rhythmbox を利用しているのですが,たまにファイルが存在するのに何度やってもダウンロードに失敗したり NotePC で動かしているので容量の問題で古いのをファイルサーバに持って行ったりといった処理が面倒です.
CIL で動くものがあればファイルサーバで入手するようにして新しい物だけ手元に or ファイルサーバ経由で視聴するようにしら便利かもということで CLI で動く podcast aggregator が無いか探してみました.

$ apt-cache search podcast aggregator
gpodder - podcast client and feed aggregator
podracer - podcast aggregator/downloader

gpodder は GUI と CLI のセットで,podracer は CLI のみのようです.今回は podracer を試してみます.

導入

導入は apt 一発です.

$ sudo apt install podracer

設定ファイルの用意

~/.podracer/subscriptions というファイルに入手したいフィードを1フィード1行で書いておきます.# 行はコメントになるようです.

# 電脳空間カウボーイズ
http://feeds.feedburner.com/weblogs/csc
# backspace.fm
http://feeds.backspace.fm/backspacefm

実行

podracer コマンドを実行すると,~/.podracer/subscriptions からpodcast をダウンドードしてくれます.ダウンロードが完了すると自動的に終了します.

$ podracer

初回実行時には過去のものも入手するので時間が掛かるでしょう.特に画面には何も表示されないのでログファイル( ~/.podracer/podcast.log ) を確認するといいと思います.

$ tail -f ~/.podracer/podcast.log

取得した podcast は ~/podcasts 以下の日付ファイルの下に保存されます.この日付は実行日時です.

$ ls ~/podcasts
2016-01-27  2016-01-28
$ ls -lA ~/podcasts/2016-01-28
合計 59408
-rw-r--r-- 1 mk mk        0  1月 28 14:03 2016-01-28-podcasts.m3u
-rw-r--r-- 1 mk mk 60833627  1月 28 14:02 jlEV91AshKrq
$ file  ~/podcasts/2016-01-28/*
/home/mk/podcasts/2016-01-28/2016-01-28-podcasts.m3u: empty
/home/mk/podcasts/2016-01-28/jlEV91AshKrq:            Audio file with ID3 version 2.3.0

後は各種プレイヤーで再生できます.

$ mplayer ~/podcasts/2016-01-28/jlEV91AshKrq

ファイル名は podcast 提供者の物のままで同じディレクトリに格納されてしまうので名前が衝突したら多分新しい方で上書きされてしまいます.それとこのままではどのファイルがどの podcast なのかとかわからないですね.オプションも特に無いようなので沢山の podcast を保管しようという用途で使うのには向いていないかもしれません.
毎日実行して今日の分をまとめて再生して消してというように使う感じなのかもしれません.

追記)プレイリストの不具合?

podracer 実行時に 2016-01-28-podcasts.m3u のようなプレイリストが作られますが,mp3/ogg/m4a/m4b 以外の拡張子は登録されません.こんな感じで作り直すと良さそう.

$ ls -1A ~/podcasts/2016-01-28 | grep -v \.m3u$ > ~/podcasts/2016-01-28/2016-01-28-podcasts.m3u

この方がいいかな

$ ls -1A ~/podcasts/`date +%F` | grep -v \.m3u$ > ~/podcasts/`date +%F`/`date +%F`-podcasts.m3u

podracer 自体を修正してもいいかも.雑いけどこんなとか.
これだとサムネイル画像なども含まれてしまう.

$ diff -u /usr/bin/podracer podracer
--- /usr/bin/podracer   2015-07-04 22:39:26.000000000 +0900
+++ podracer    2016-01-28 18:34:40.317391930 +0900
@@ -415,10 +415,7 @@
                then
                (
                cd "$poddir"
-               find . -name \*.mp3 > "$m3u"
-               find . -name \*.ogg  >> "$m3u"
-               find . -name \*.m4a  >> "$m3u"
-               find . -name \*.m4b  >> "$m3u"
+               find . -name \* -type f | grep -v "$m3u" > "$m3u"
                )
        fi
 fi

追記2)
上の修正だとサムネイル画像なども登録されてしまう.
以下はその他のファイルを file command で調べて audio という文字列が入っていたら登録するもの.

$ diff -u /usr/bin/podracer ./podracer
--- /usr/bin/podracer   2015-07-04 22:39:26.000000000 +0900
+++ ./podracer  2016-01-28 19:12:31.980446668 +0900
@@ -419,6 +419,7 @@
                find . -name \*.ogg  >> "$m3u"
                find . -name \*.m4a  >> "$m3u"
                find . -name \*.m4b  >> "$m3u"
+               find . | egrep -v "\.mp3$|\.ogg$|\.m4a$|\.m4b$" | xargs file | grep -i audio | cut -f1 -d: >> "$m3u"
                )
        fi
 fi

]]>
https://matoken.org/blog/2016/01/28/try-the-cli-of-podcat-aggregator-downloader-of-podracer/feed/ 3
awk 製 3Dシューティングゲーム awkaster で遊んでみた https://matoken.org/blog/2016/01/18/i-tried-playing-around-with-awk-made-3d-shooter-game-awkaster/ https://matoken.org/blog/2016/01/18/i-tried-playing-around-with-awk-made-3d-shooter-game-awkaster/#comments Mon, 18 Jan 2016 11:19:36 +0000 http://matoken.org/blog/?p=1071 awk 製 3Dシューティングゲームがあると聞いて遊んでみました.

遊ぶには GNU awk 4.0.0 以上が必要です.Debian だと gawk というパッケージです.とりあえず遊んでみるにはこんな感じで.

$ sudo apt install gawk
$ wget https://raw.githubusercontent.com/TheMozg/awk-raycaster/master/awkaster.awk
$ awk -f ./awkaster.awk

操作はこんな感じです.

  • 1234 画面表示切り替え
  • WASD 移動
  • JL 回転(16回で1回転)/Shiftを押しながらで高速回転(8回で1回転)
  • SPACE 攻撃
  • X エレベーターに乗る(ゲームクリア)
  • Q 終了

以下は遊んでいる様子です.

asciicast

3Dシューティングというとスターフォックスを思い浮かべたのですが,単純な 3D RPG 的な感じです.Wolfenstein 3D と doom に触発されたそうです.Wolfenstein 3DWolfenstein 3D は知らないのですが確かに doom みたいな感じです.
ターン制?なので敵の赤球が出てきても慌てず操作できます.

敵に触れるとHPが減っていって0になるとゲームオーバーでこんなメッセージが出ます.

GAME OVER! YOU LOSE!
Credits: Fedor 'TheMozg' Kalugin
https://github.com/TheMozg/awk-raycaster
Gameplay testing - Alex 'Yakojo' & Danya 'bogych97'
Go away!

うまいことエレベーターに到着して X を押すとゲームクリアです.
但し ELEVATOR COMING0 になっている必要があります.これは初め 1000 で1操作で1カウントダウンされます.ゴールのエレベーターの場所は見た目わかりません
敵が沢山居るところの辺りにあるので探してみて下さい.
(私は判んなくて結局 source 読んでクリアしましたorz)

YOU WIN! YOUR SCORE: 4900
Credits: Fedor 'TheMozg' Kalugin
https://github.com/TheMozg/awk-raycaster
Gameplay testing - Alex 'Yakojo' & Danya 'bogych97'
Go away!

ちなみにそこそこ広い領域が必要です.領域が狭いと画面に収まりきらずずれてしまいます.フォントサイズを小さくするなどして列と行を確保しましょう.
GNU screen 上でも Rasbian jessie 上でも問題なく動きました.

昔こんな3D迷路とかをポケコンBASIC で作っていたのを思い出しました.最近のマイコンやRaspberry Pi でこういうゲームを作ってみるのも楽しそうですね :)
(Arduboy とか POCKETC.H.I.P. とか )

]]>
https://matoken.org/blog/2016/01/18/i-tried-playing-around-with-awk-made-3d-shooter-game-awkaster/feed/ 3
フレームバッファで焼かれるあひるを録画する(あひる焼き Advent Calendar 2015) https://matoken.org/blog/2015/12/15/recording-a-duck-that-is-baked-in-the-frame-buffer-duck-baked-advent-calendar-2015/ https://matoken.org/blog/2015/12/15/recording-a-duck-that-is-baked-in-the-frame-buffer-duck-baked-advent-calendar-2015/#respond Tue, 15 Dec 2015 10:25:58 +0000 http://matoken.org/blog/?p=1058 この記事は あひる焼き Advent Calendar 2015の12月15日分の記事です.
#2度めですが1週間ほど空きがあったので.


🔥

以前こんな記事を書きました.

この時は

#terminal をフレームバッファも含めて動画でスクリーンショットとる方法が解らず今回は仮想マシンで実行してキャプチャしました.だれか端末のフレームバッファも含めての動画でのスクリーンショットのとり方を知ってる人が居たら教えて下さいo

という感じでフレームバッファの動画の録画方法が解らず,別のカメラで画面を録画していました.調べたら方法が見つかったので今回はその手順を紹介したいと思います.

といっても avconvffmpeg でフレームバッファを指定するだけです.
#Debian stretch からはまた libav から FFmpeg に戻るようです. > libav and FFmpeg: switch over

$ avconv -f fbdev -i /dev/fb0 fb.mp4
$ ffmpeg -f fbdev -i /dev/fb0 fb.mp4

これで録画したのがこちらです.

これで画面をカメラで録画したりしなくても焼かれるあひるが録画できるようになりました :)

]]>
https://matoken.org/blog/2015/12/15/recording-a-duck-that-is-baked-in-the-frame-buffer-duck-baked-advent-calendar-2015/feed/ 0